table_name syntax

Mark Taylor m.b.taylor at bristol.ac.uk
Tue Apr 28 14:18:30 CEST 2015


On Tue, 28 Apr 2015, Markus Demleitner wrote:

> I'd fairly strongly suggest that all DB names should be in a form
> ready for usage.  While the case:
> 
> >    +-------------------+-------------+
> >    | table_name        | column_name |
> >    +-------------------+-------------+
> >    | B/avo.rad/catalog | Sp-Index    |
> >    +-------------------+-------------+
> > 
> 
> might conceivably be caugt by clients who might themselves see that
> Sp-Index simply cannot be a delimited identifier, this is impossible
> for a column_name 'FooBar' -- this might work as a regular identifier,
> but *if* it's a delimited identifer, only '"FooBar"' will work.

I *think* you meant to write instead:

    "... Sp-Index simply cannot be a regular identifier ..."

If not, I'm afraid I need more elucidation.

Assuming I've got that right ... then I see your point
(I don't need python to tell me that guessing is evil :-]).
I suspect in that case there are a number of TAP services out there
broken in this respect (taplint hasn't been looking for them up till
now), though disappointingly I can only find a couple of examples
at GAVO DC (vlastripe82.stripe82 column _ct, plus an empty schema
mwsc-e14a which maybe doesn't count).

A possible alternative: outlaw
delimited-identifiers-that-don't-have-to-be-delimited,
i.e. column_name values which are lexically legal regular identifiers
like FooBar must represent regular identifiers, though values
which are illegal regular identifiers (like Foo-Bar) obviously don't.
Stated like that it sounds a bit complex, though it does fall in
line with your project of marginalising use of delimited identifiers,
and it also has the advantage that none of the logic in my code
needs to change :-).

Supplementary question: does "form ready for usage" include
quoting to avoid collision with ADQL reserved words?
If so, I've got a few more GAVO column names I can beat you with
(distance, size, date, section).

Mark

--
Mark Taylor   Astronomical Programmer   Physics, Bristol University, UK
m.b.taylor at bris.ac.uk +44-117-9288776  http://www.star.bris.ac.uk/~mbt/


More information about the dal mailing list