table_name syntax
Mark Taylor
m.b.taylor at bristol.ac.uk
Mon Apr 27 16:00:31 CEST 2015
Hi DAL,
I have an arcane query about how to represent and interpret TAP
service table names that appear in
(a) the table_name column of the TAP_SCHEMA.tables table
(b) tableset/schema/table/name elements in a TableSet document
(I'm assuming the answer is the same for both unless somebody says
different)
TAP v1.0 sec 2.6.2 says:
The value of the table_name should be the string that is
recommended for use in querying the table; it may or may not be
qualified by schema and catalog name(s) depending on the implementation
requirements. The fully qualified table name is defined by the
ADQL language and follows the pattern [[catalog.]schema.]table.
My question is: if the catalog, schema or table parts of the table_name
do not match ADQL's identifier syntax, must they be quoted as delimited
identifiers?
For many TAP services this is probably not an issue, but it sure is
for TAPVizieR, where table names usually contain the "/" character
and sometimes other non-identifier characters too. For instance,
(http://tapvizier.u-strasbg.fr/beta/TAPVizieR/tap):
select top 3 schema_name, table_name from tap_schema.tables
where schema_name='viz4'
gives
+-------------+-------------------+
| schema_name | table_name |
+-------------+-------------------+
| viz4 | B/avo.rad/catalog |
| viz4 | B/avo.rad/wsrt |
| viz4 | B/bax/bax |
+-------------+-------------------+
Should it instead give
+-------------+---------------------+
| schema_name | table_name |
+-------------+---------------------+
| viz4 | "B/avo.rad/catalog" |
| viz4 | "B/avo.rad/wsrt" |
| viz4 | "B/bax/bax" |
+-------------+---------------------+
?
I initially thought the answer to this was no.
But if that's the case, how do I tell[*] whether the
first entry in the result above is
table "B/avo.rad/catalog" from an unnamed schema (which it is) or
table "rad/catalog" from schema "B/avo" (which it's not).
If the answer is yes, then (a) TAPVizier and possibly some other
services will need to change their content to comply, and
(b) what is the rule for other TAP_SCHEMA columns like
schema_name and column_name (and others?)? Quoting these columns
would be unnecessary (since there is no possibility of delimited
parts in this case), but it would seem inconsistent to require
quoting for some of these metadata columns and not others;
at least it should be documented explicitly.
Thanks!
Mark
[*] the ugly hack answer is obviously: see if the apparent schema
is the same as the schema_name column. This would give you an
almost-certainly-correct indication of what you're looking at,
but it's fiddly, inelegant and not bulletproof.
--
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