DG
=> TRUNCATE temp_test;Не работает, судя по всему...
TRUNCATE TABLE
unisocial=> SELECT COUNT(*) FROM temp_test;
count
-------
0
(1 row)
=> INSERT INTO temp_test VALUES(1) ON CONFLICT (id) DO UPDATE SET id = EXCLUDED.id RETURNING id;
id
----
1
(1 row)
INSERT 0 1
=> SELECT COUNT(*) FROM temp_test;
count
-------
1
(1 row)
=> INSERT INTO temp_test VALUES(1) ON CONFLICT (id) DO UPDATE SET id = EXCLUDED.id RETURNING id;
id
----
1
(1 row)
INSERT 0 1
=> SELECT COUNT(*) FROM temp_test;
count
-------
1
(1 row)
=> \d+ temp_test
Table "public.temp_test"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+--------+-----------+----------+---------------------------------------+---------+--------------+-------------
id | bigint | | not null | nextval('temp_test_id_seq'::regclass) | plain | |
Indexes:
"temp_test_pkey" PRIMARY KEY, btree (id)


