Re: Persistent changes in rolled-back transactions
От | Wells Oliver |
---|---|
Тема | Re: Persistent changes in rolled-back transactions |
Дата | |
Msg-id | CAOC+FBX2DWpgb-Ny3Y5yEFGftXX2_wZNG1W3XePa7oRAMxP1Rg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Persistent changes in rolled-back transactions (Wael Khobalatte <wael@vendr.com>) |
Ответы |
Re: Persistent changes in rolled-back transactions
|
Список | pgsql-admin |
Why do you say truncate is non-transactional? Something simple proves that it's not?
wells=# create table foo (f text);
wells=# insert into foo values('cat');
INSERT 0 1
wells=# select * from foo;
f
-----
cat
(1 row)
wells=# begin;
BEGIN
wells=*# truncate foo;
TRUNCATE TABLE
wells=*# rollback;
ROLLBACK
wells=# select * from foo;
f
-----
cat
(1 row)
wells=# insert into foo values('cat');
INSERT 0 1
wells=# select * from foo;
f
-----
cat
(1 row)
wells=# begin;
BEGIN
wells=*# truncate foo;
TRUNCATE TABLE
wells=*# rollback;
ROLLBACK
wells=# select * from foo;
f
-----
cat
(1 row)
On Wed, Nov 9, 2022 at 5:16 PM Wael Khobalatte <wael@vendr.com> wrote:
> I've noticed serials still maintain incremented values even when a transaction is rolled back. Are there other similar persistent changes to be aware of?
Postgres sequences (what backs the serial type) are non-transactional. nextval, setval, et al. Truncate is also non-transactional.
Wells Oliver
wells.oliver@gmail.com
wells.oliver@gmail.com
В списке pgsql-admin по дате отправления: