Re: 9.2 timestamp function syntax error

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: 9.2 timestamp function syntax error
Дата
Msg-id 11816.1362508023@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: 9.2 timestamp function syntax error  (Guy Rouillier <guy.rouillier@gmail.com>)
Список pgsql-general
Guy Rouillier <guy.rouillier@gmail.com> 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


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Floating point error
Следующее
От: Maciek Sakrejda
Дата:
Сообщение: Re: [HACKERS] Floating point error