Re: Arrays versus 'type constant' syntax - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: Arrays versus 'type constant' syntax
Date
Msg-id 378CC647.40B0FBAC@alumni.caltech.edu
Whole thread Raw
In response to Re: Arrays versus 'type constant' syntax  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Re: Arrays versus 'type constant' syntax
List pgsql-hackers
> >> 2. Remove "AexprConst ::= Typename Sconst" from the grammar.  I do
> >> not believe this rule is in SQL92.
> > Sorry, this *is* SQL92 syntax.
> I've just grepped the SQL92 spec in some detail, and I see noplace
> that allows "typename stringconstant".  "::" is indeed not standard,
> but the only type conversion syntax I see in the spec is
>         CAST (value AS type)
> If I'm missing something, please cite chapter and verse.

Well, ahem, er...

It isn't an explicit general construct in SQL92, since there are only
a few data types defined in the language, and since type extensibility
is not supported.

However, the language does define syntax for specifying date/time
literals (the only string-like literal which is not a string type) and
that would seem to suggest the general solution. 

Allowed in SQL92 (according to my 2 reference books, and I may have
missed more info):

'Bastille Day' -- string literal
DATE '7/14/1999' -- date literal
TIMESTAMP '7/14/1999 09:47' -- date/time literal
TIME '09:47' -- time literal

SQL3 should have more to say on the subject, and does, but I've got
old versions of draft docs and have (so far) only found brief mention
of ADTs etc. Perhaps they intend the CAST construct to cover this, but
istm that it isn't a natural extension of the older forms mentioned
above.
                      - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Interesting behaviour !
Next
From: Thomas Lockhart
Date:
Subject: Re: [HACKERS] Interesting behaviour !