What is the "literal" syntax in Postgres?

Postgres docs say an actor should look like ...

expression::typename
typename(expression)
cast(expression as typename)

But it works:

select date '2015-06-20';

What is this syntax? Where is this documented?

+4
source share
1 answer

A constant is typed - see http://www.postgresql.org/docs/9.4/static/sql-syntax-lexical.html section 4.1.2.7. Constants of other types.

An arbitrary type constant can be entered using any of the following notation:

type 'string'
'string' :: type
CAST ('string' AS type)
+5
source

All Articles