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

From: Piotr Gasidło <quaker(at)barbara(dot)eu(dot)org>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: SELECT 'NOW()' - OK, SELECT 'CLOCK_TIMESTAMP()' - ERROR
Date: 2014-08-22 06:40:22
Message-ID: CAF8akQtfD4SvVg0iR_TcPUAFhyr9kEZFBj7_NQ_fe4NKvp_aKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ian Barwick 2014-08-22 07:00:10 Re: SELECT 'NOW()' - OK, SELECT 'CLOCK_TIMESTAMP()' - ERROR
Previous Message Steve Kehlet 2014-08-22 00:54:24 Re: hot_standby_feedback vs. max_standby_archive_delay/max_standby_streaming_delay?