Re: difference between current_timestamp and now() in quotes

From: Dhaval Jaiswal <bablu_postgres(at)yahoo(dot)com>
To: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>, GENERAL <pgsql-general(at)postgresql(dot)org>
Subject: Re: difference between current_timestamp and now() in quotes
Date: 2009-03-26 23:28:29
Message-ID: 996803.6917.qm@web111204.mail.gq1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"current_timestamp" is the reserved keyword of postgreSQL. When you executes it within single quotation mark it treated as string & that is the only reason it thrown error.

"Now()" is an in-built function you can use it with/without single quotation mark.

For more information refere the below link.
http://www.postgresql.org/docs/8.1/static/sql-keywords-appendix.html

--
Thanks & Regards
Dhaval Jaiswal
EnterpriseDB
www.enterprisedb.com

 

________________________________
From: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
To: GENERAL <pgsql-general(at)postgresql(dot)org>
Sent: Thursday, January 22, 2009 7:22:21 PM
Subject: [GENERAL] difference between current_timestamp and now() in quotes

test2=# create table dupa(a timestamp,  b serial);
NOTICE:  CREATE TABLE will create implicit sequence "dupa_b_seq" for
serial column "dupa.b"
CREATE TABLE

test2=# insert into dupa(a) select current_timestamp from
generate_series(1,100);
INSERT 0 100

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 ?

--
GJ

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2009-03-26 23:37:07 Re: Is there a meaningful benchmark?
Previous Message Raymond O'Donnell 2009-03-26 23:23:35 Re: Is there a meaningful benchmark?