Re: PGsql function timestamp issue

Поиск
Список
Период
Сортировка
От Vinayak Pokale
Тема Re: PGsql function timestamp issue
Дата
Msg-id 1406278752273-5812825.post@n5.nabble.com
обсуждение исходный текст
Ответ на PGsql function timestamp issue  (ng <pipelines@gmail.com>)
Список pgsql-sql
Hello,

The current_timestamp return the constant value in a transaction. So use
clock_timestamp().
Example:
create or replace function fx_nish()
returns text language plpgsql as
$$
declare
x timestamp with time zone;
y timestamp with time zone;
begin
x:= clock_timestamp();
perform pg_sleep(5);
y:= clock_timestamp();
if x=y then
return 'SAME';
else
return 'DIFFERENT';
end if;

end;
$$
;
postgres=# select fx_nish(); fx_nish  
-----------DIFFERENT
(1 row)




-----
Thanks and Regards,
Vinayak Pokale,
NTT DATA OSS Center Pune, India
--
View this message in context:
http://postgresql.1045698.n5.nabble.com/PGsql-function-timestamp-issue-tp5805486p5812825.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.



В списке pgsql-sql по дате отправления:

Предыдущее
От: Benjamin Dugast
Дата:
Сообщение: Re: Is CREATE TABLE non-blocking ?
Следующее
От: Andreas Joseph Krogh
Дата:
Сообщение: Update columns in the same table in a deferred constraint trigger