Re: insert a SYSTIMESTAMP value in postgres - Mailing list pgsql-general

From Leon Match
Subject Re: insert a SYSTIMESTAMP value in postgres
Date
Msg-id 000001cc3017$73f3f290$5bdbd7b0$@match@convergia.net
Whole thread Raw
In response to insert a SYSTIMESTAMP value in postgres  ("Leon Match" <leon.match@convergia.net>)
List pgsql-general
Thanks a lot for your help!

The correct sentence to my solution is this:

insert into request_queue (request_id, received_time
                                      )
      values   (new.request_id, LOCALTIMESTAMP
                  );

Regards,
Leon

-----Original Message-----
From: Osvaldo Kussama [mailto:osvaldo.kussama@gmail.com]
Sent: Monday, June 20, 2011 3:45 PM
To: Leon Match
Subject: Re: [GENERAL] insert a SYSTIMESTAMP value in postgres

2011/6/20 Leon Match <leon.match@convergia.net>:
> Hello,
>
> I am trying to re-create few objects  from oracle into postgres.
>
> I have a problem inserting a timestamp value into the table:
>
> insert into request_queue (request_id, received_time)
>         values   (new.request_id, SYSTIMESTAMP);
>
> How can I insert a dynamic timestamp value in postgress, please?
>


In Oracle/PLSQL, the systimestamp function returns the current system
date and time (including fractional seconds and time zone) on your
local database.

In PostgreSQL see the manual:
http://www.postgresql.org/docs/current/interactive/functions-datetime.html#F
UNCTIONS-DATETIME-CURRENT
"CURRENT_TIME and CURRENT_TIMESTAMP deliver values with time zone.
PostgreSQL also provides functions that return the start time of the
current statement, as well as the actual current time at the instant
the function is called. The complete list of non-SQL-standard time
functions is:

transaction_timestamp()
statement_timestamp()
clock_timestamp()
timeofday()
now()

transaction_timestamp() is equivalent to CURRENT_TIMESTAMP, but is
named to clearly reflect what it returns. statement_timestamp()
returns the start time of the current statement (more specifically,
the time of receipt of the latest command message from the client).
statement_timestamp() and transaction_timestamp() return the same
value during the first command of a transaction, but might differ
during subsequent commands. clock_timestamp() returns the actual
current time, and therefore its value changes even within a single SQL
command."

Osvaldo


pgsql-general by date:

Previous
From: Pawel Kukawski
Date:
Subject: Limited number of simultaneous connections on Windows
Next
From: Vick Khera
Date:
Subject: Re: getting postgres server on freebsd startup?