From: | Wells Oliver <wells(dot)oliver(at)gmail(dot)com> |
---|---|
To: | Wael Khobalatte <wael(at)vendr(dot)com> |
Cc: | pgsql-admin <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: Persistent changes in rolled-back transactions |
Date: | 2022-11-10 01:18:54 |
Message-ID: | CAOC+FBX2DWpgb-Ny3Y5yEFGftXX2_wZNG1W3XePa7oRAMxP1Rg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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)
On Wed, Nov 9, 2022 at 5:16 PM Wael Khobalatte <wael(at)vendr(dot)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(dot)oliver(at)gmail(dot)com <wellsoliver(at)gmail(dot)com>
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2022-11-10 01:20:22 | Re: Persistent changes in rolled-back transactions |
Previous Message | Wael Khobalatte | 2022-11-10 01:16:33 | Re: Persistent changes in rolled-back transactions |