length of string query in Topcat TAP

Dave Morris dave.morris at metagrid.co.uk
Wed Apr 14 14:35:50 CEST 2021


Hi Petr,

As far as I know, LENGTH(), CHAR_LENGTH() or SIZE() aren't part of ADQL.

They are in list of SQL reserved words which just means they are 
reserved to be used in future versions of ADQL, preventing people from 
using them for other things in the mean time.

If you think we should have something like LENGTH() in ADQL then please 
go ahead and add a new issue in the GitHub project.
https://github.com/ivoa-std/ADQL

-- Dave

On 2021-04-06 11:42, Petr Skoda wrote:
> Dear all,
> 
> I wanted to get a guess of maximum length of spectral type string in
> SIMBAD (in order to limit database collumn declaration in one our
> archiving system ) by TAP query run through TOPCAT window and I
> failed.
> 
> On http://simbad.u-strasbg.fr:80/simbad/sim-tap
> 
> I tried the query
> 
> SELECT top 100
>    sp_type as sp, LENGTH(sp_type)
>    FROM basic
> where sp_type is not null
> 
> but TOPCAT does not allow (red syntax ) me to type lenght, LENGTH ,
> CHAR_LENGTH or anything else (e.g. SIZE) ... in ADQL is CHAR_LENGTH a
> reserved word , but when enforcing the TAP submission it complains on
> it
> (was expecting .... and long list of keywords) but then it warns
> 
> 
> (HINT: "CHAR_LENGTH" is not supported in ADQL, but is however a
> reserved word. To use it as a column/table/schema name/alias, write it
> between double   quotes)
> 
> I am a little confused ... Is it a problem of TOPCAT syntax checker or
> a general lack in ADQL .... in other words, the ADQL does not allow to
> measure the length of a string atribute ?
> 
> 
> Thanks for explanation
> 
> 
> (BTW I succeeded just to load all sp_types in a table and then used
> the TOPCAT internal function length(string) in a new synhetic collumn
> directly on a table. But if I would not be able to download all SIMBAD
> sp_types to TOPCAT I would be lost just by using ADQL ....
> 
> 
> Best regards,
> 
> 
> Petr
> *************************************************************************
> *  Petr Skoda                         Phone : +420-323-649201, ext. 361 
> *
> *  Stellar Department                         +420-323-620361           
> *
> *  Astronomical Institute CAS         Fax   : +420-323-620250           
> *
> *  251 65 Ondrejov                    e-mail: skoda at sunstel.asu.cas.cz  
> *
> *  Czech Republic                             skoda at asu.cas.cz          
> *
> *************************************************************************


More information about the grid mailing list