SELECT 'NOW()' - OK, SELECT 'CLOCK_TIMESTAMP()' - ERROR

Поиск
Список
Период
Сортировка
От Piotr Gasidło
Тема SELECT 'NOW()' - OK, SELECT 'CLOCK_TIMESTAMP()' - ERROR
Дата
Msg-id CAF8akQtfD4SvVg0iR_TcPUAFhyr9kEZFBj7_NQ_fe4NKvp_aKA@mail.gmail.com
обсуждение исходный текст
Ответы Re: SELECT 'NOW()' - OK, SELECT 'CLOCK_TIMESTAMP()' - ERROR  (Ian Barwick <ian@2ndquadrant.com>)
Re: SELECT 'NOW()' - OK, SELECT 'CLOCK_TIMESTAMP()' - ERROR  (David G Johnston <david.g.johnston@gmail.com>)
Список pgsql-general
Hello,

I found strange PostgreSQL 9.3 behavior:

> select now()::timestamp, 'now()'::timestamp;
            now             |         timestamp          
----------------------------+----------------------------
 2014-08-22 08:34:00.883268 | 2014-08-22 08:34:00.883268

Second column is now() in single apostrophes.

Now, I tried similar function, clock_timestamp() and get:

> select clock_timestamp()::timestamp, 'clock_timestamp()'::timestamp;
ERROR:  invalid input syntax for type timestamp: "clock_timestamp()"
LINE 1: select clock_timestamp()::timestamp, 'clock_timestamp()'::ti...
                                               ^

Why is NOW() so special? Where is it documented? And why not working with other timestamp returning internal functions?

> select version();
                                                               version                                                                
--------------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 9.3.4 on amd64-portbld-freebsd10.0, compiled by FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610, 64-bit
(1 wiersz)


--
Piotr Gasidło

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

Предыдущее
От: Steve Kehlet
Дата:
Сообщение: Re: hot_standby_feedback vs. max_standby_archive_delay/max_standby_streaming_delay?
Следующее
От: Ian Barwick
Дата:
Сообщение: Re: SELECT 'NOW()' - OK, SELECT 'CLOCK_TIMESTAMP()' - ERROR