Re: difference between current_timestamp and now() in quotes

From: Jason Long <mailing(dot)list(at)supernovasoftware(dot)com>
To: Adrian Klaver <aklaver(at)comcast(dot)net>
Cc: pgsql-general(at)postgresql(dot)org, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
Subject: Re: difference between current_timestamp and now() in quotes
Date: 2009-01-22 17:07:37
Message-ID: 4978A7D9.4010504@supernovasoftware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adrian Klaver wrote:
> On Thursday 22 January 2009 8:16:46 am Alvaro Herrera wrote:
>
>> Grzegorz Jaśkiewicz escribió:
>>
>>> test2=# insert into dupa(a) select 'current_timestamp' from
>>> generate_series(1,100);
>>> ERROR: date/time value "current" is no longer supported
>>> LINE 1: insert into dupa(a) select 'current_timestamp' from generate...
>>> ^
>>> test2=# insert into dupa(a) select 'now()' from generate_series(1,100);
>>> INSERT 0 100
>>>
>>>
>>> Any ideas why the difference ?
>>>
>> The parser handles CURRENT_TIMESTAMP (and others) specially, and doesn't
>> recognize it in quotes. I don't know why 'now()' works; I think it is a
>> literal of type unknown. I guess it's expanded to the actual value in
>> later parsing stages.
>>
>> --
>> Alvaro Herrera http://www.CommandPrompt.com/
>> PostgreSQL Replication, Consulting, Custom Development, 24x7 support
>>
>
> At least on 8.2 'now()' does not work either at least not in the way I think
> you want. I get:
>
> test=# SELECT 'now()';
> ?column?
> ----------
> now()
> (1 row)
>
>
>
>
Try
select now();

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Goodenough 2009-01-22 17:18:16 problem converting database to UTF-8
Previous Message Adrian Klaver 2009-01-22 17:03:33 Re: difference between current_timestamp and now() in quotes