Re: Migration from DB2 to PostgreSQL-TIMESTAMP(arg1,arg1) - Mailing list pgsql-general

From Raymond O'Donnell
Subject Re: Migration from DB2 to PostgreSQL-TIMESTAMP(arg1,arg1)
Date
Msg-id 51CC287D.6040805@iol.ie
Whole thread Raw
In response to Re: Migration from DB2 to PostgreSQL-TIMESTAMP(arg1,arg1)  (sachin kotwal <kotsachin@gmail.com>)
Responses Re: Migration from DB2 to PostgreSQL-TIMESTAMP(arg1,arg1)
Re: Migration from DB2 to PostgreSQL-TIMESTAMP(arg1,arg1)
List pgsql-general
On 27/06/2013 12:51, sachin kotwal wrote:
> I have done some more try as follows:
>
> #select timestamp(current_date);
> ERROR:  syntax error at or near "current_date" at character 18
> STATEMENT:  select timestamp(current_date);
> ERROR:  syntax error at or near "current_date"
> LINE 1: select timestamp(current_date);
> ======================================================

If you're trying to convert a string to a timestamp as in your first
email, you probably want to_timestamp():

  http://www.postgresql.org/docs/9.2/static/functions-formatting.html

Otherwise, current_timestamp and friends produce the current date & time:

  http://www.postgresql.org/docs/9.2/static/functions-datetime.html

HTH,

Ray.



>
> #SELECT TIMESTAMP(to_date('2013-01-01','YYYY-MM-DD'));
> ERROR:  syntax error at or near "to_date" at character 18
> STATEMENT:  SELECT TIMESTAMP(to_date('2013-01-01','YYYY-MM-DD'));
> ERROR:  syntax error at or near "to_date"
> LINE 1: SELECT TIMESTAMP(to_date('2013-01-01','YYYY-MM-DD'));
> ======================================================
>
> select timestamp(current_date,current_time);
> ERROR:  syntax error at or near "current_date" at character 18
> STATEMENT:  select timestamp(current_date,current_time);
> ERROR:  syntax error at or near "current_date"
> LINE 1: select timestamp(current_date,current_time);
> ======================================================
>
> #SELECT TIMESTAMP(to_date('2013-01-01','YYYY-MM-DD'),'17:15:43'::time);
> ERROR:  syntax error at or near "to_date" at character 18
> STATEMENT:  SELECT
> TIMESTAMP(to_date('2013-01-01','YYYY-MM-DD'),'17:15:43'::time);
> ERROR:  syntax error at or near "to_date"
> LINE 1: SELECT TIMESTAMP(to_date('2013-01-01','YYYY-MM-DD'),'17:15:4...
>
>
>
> --
> View this message in context:
http://postgresql.1045698.n5.nabble.com/Migration-from-DB2-to-PostgreSQL-TIMESTAMP-arg1-arg1-tp5761389p5761390.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>


--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie


pgsql-general by date:

Previous
From: sachin kotwal
Date:
Subject: Re: Migration from DB2 to PostgreSQL-TIMESTAMP(arg1,arg1)
Next
From: Sandro Santilli
Date:
Subject: Triggers NOT running as table owner