Code : Tout sélectionner
select version();
version
--------------------------------------------------------------------------------------------
PostgreSQL 11devel on x86_64-pc-linux-gnu, compiled by gcc (Debian 7.2.0-16) 7.2.0, 64-bit
(1 ligne)
start transaction;
START TRANSACTION
create table all_times(cu timestamp, st timestamp, cl timestamp);
CREATE TABLE
CREATE PROCEDURE pg_temp.insert_times()
LANGUAGE SQL
AS $$
INSERT INTO all_times(cu, st, cl) VALUES (current_timestamp, statement_timestamp(), clock_timestamp());
$$;
CREATE PROCEDURE
CALL pg_temp.insert_times();
CALL
CALL pg_temp.insert_times();
CALL
CALL pg_temp.insert_times();
CALL
select * from all_times;
cu | st | cl
----------------------------+----------------------------+----------------------------
2017-12-04 10:50:10.534769 | 2017-12-04 10:50:32.398735 | 2017-12-04 10:50:32.399498
2017-12-04 10:50:10.534769 | 2017-12-04 10:50:37.670564 | 2017-12-04 10:50:37.670967
2017-12-04 10:50:10.534769 | 2017-12-04 10:50:43.103117 | 2017-12-04 10:50:43.103508
(3 lignes)
rollback;
ROLLBACK
\q