Search Postgresql Archives

Re: 9.2 timestamp function syntax error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Guy Rouillier <guy.rouillier@xxxxxxxxx> writes:
> Ugh, I just noticed the quotation marks around the timestamp function. 
> This works:

> select "timestamp"(now()::timestamptz); => timestamp without time zone

> This is a subtlety bound to be lost on most.  Why is there both a 
> function and a type name with the same name?

All cast functions are named after the target type, by convention.

> I suppose I could define a 
> synonym to make the function name distinct, but this seems like 
> something that should be addressed.

Really the right way to address it is to use cast notation.  The
function notation is sometimes convenient, but you have to worry
about gotchas like this one, not to mention that some built-in
types have multiple aliases.

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux