ADQL using reserved words in tables

Gregory MANTELET gregory.mantelet at astro.unistra.fr
Thu Nov 14 11:52:57 CET 2019


On 14/11/2019 11:40, Jon Juaristi Campillo wrote:
> Hi Ada,
>
> On 19/11/14 10:11, ada nebot wrote:
>> Hi Gregory,
>>
>> Yes I have tried the ASCII double quotes (my email converted those 
>> into funny characters).
>> It doesn’t work - at least not from TOPCAT.
>>
>> Cheers,
>> Ada
>
> As far as I know, although `public` is a reserved keyword it is a 
> valid identifier for an schema. It is the default one, which will be 
> queried when none is specified.


A little correction here: `public` is the default schema....in Postgres 
databases. It is not the default schema in ADQL/TAP.


> I was wondering and I tested the next queries with both TOPCAT 4.6.1 
> and PyVO:
>
> SELECT TOP 10 * from "public".hipparcos_newreduction
> SELECT TOP 10 * from public.hipparcos_newreduction
> SELECT TOP 10 * from hipparcos_newreduction
>
> Only the first one failed in TOPCAT (error message being “1 unresolved 
> identifiers: hipparcos_newreduction”), whereas in the rest the same 
> data were returned.
>
> Maybe omitting `public` might work... but it is strange.


Indeed, it should work in this particular case.
In ADQL/TAP, it is not always required to prefix with the schema name. 
You must absolutely do it only in case of ambiguous table name (e.g. 
tables `public.stuff` and `another.stuff`)....am I wrong?

As far as I understood, `TAP_SCHEMA.tables.table_name` should contain 
the recommended way to reference a table. I tend to think that the 
"recommended way" should always be the simplest as possible (for non 
`TAP_SCHEMA` tables)...which means no schema prefix if not needed.

Cheers,
Grégory


More information about the dal mailing list