From: | "Leon Match" <leon(dot)match(at)convergia(dot)net> |
---|---|
To: | "'Osvaldo Kussama'" <osvaldo(dot)kussama(at)gmail(dot)com> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: insert a SYSTIMESTAMP value in postgres |
Date: | 2011-06-21 13:30:57 |
Message-ID: | 000001cc3017$73f3f290$5bdbd7b0$@match@convergia.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(dot)kussama(at)gmail(dot)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(dot)match(at)convergia(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Vick Khera | 2011-06-21 13:38:35 | Re: getting postgres server on freebsd startup? |
Previous Message | BGoebel | 2011-06-21 11:24:49 | PostgreSQL 9.1 / Collations / case insensitive german sort order |