TIMESTAMP <string-literal>

From: J Lumby <johnlumby(at)hotmail(dot)com>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: TIMESTAMP <string-literal>
Date: 2020-07-13 17:47:53
Message-ID: DM6PR06MB5562B1FF2E945511D3079101A3600@DM6PR06MB5562.namprd06.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

I am curious about the syntactic nature of the expression :

TIMESTAMP '2020-07-13'

in this expression,  is the token TIMESTAMP a function, typecast,  or other?

I don't see a description of it as a function and there are no
parentheses in this example.

But this expression also doesn't seem to conform to the described forms
for a typecast.

I do see this text in the description of typecast :

-----------------------------------------------------------------------------------------------------

It is also possible to specify a type cast using a function-like syntax:

typename ( expression )

-----------------------------------------------------------------------------------------------------

which also lists some types which can be used this way,  including
timestamp, but this description implies that parentheses are mandatory
and also says that in the case of timestamp the name must be double-quoted.

I also tried

FLOAT8 '7.3'

and that is accepted as well.     So maybe the above syntax description
should indicate that parentheses are optional?

Or if not,  where in the documentation is this syntax described?

Cheers,   John Lumby

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2020-07-13 18:38:23 Re: Default setting for enable_hashagg_disk
Previous Message Alvaro Herrera 2020-07-13 16:47:36 Re: Default setting for enable_hashagg_disk