Search Postgresql Archives

Re: difference between current_timestamp and now() in quotes

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

 



On 2009-01-22, Adrian Klaver <aklaver@xxxxxxxxxxx> 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)

 'now'             is a string which can be translated to timestamp 
 now()             is a function that returns the current timestamp
 current_timestamp is a constant that does the same




-- 
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