From: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Fix propagation of persistence to sequences in ALTER TABLE / ADD COLUMN |
Date: | 2024-02-08 06:04:47 |
Message-ID: | CAExHW5vfiOczkiABV8p6MvsnZi45_3kZmUhg49uoaAq1PGOc1Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Feb 5, 2024 at 9:21 PM Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> Commit 344d62fb9a9 (2022) introduced unlogged sequences and made it so
> that identity/serial sequences automatically get the persistence level
> of their owning table. But this works only for CREATE TABLE and not for
> ALTER TABLE / ADD COLUMN. This patch fixes that. (should be
> backpatched to 15, 16)
The patch looks ok.
+ seqstmt->sequence->relpersistence = cxt->rel ?
cxt->rel->rd_rel->relpersistence : cxt->relation->relpersistence;
+
This condition looks consistent with the other places in the code
around line 435, 498. But I was worried that cxt->rel may not get
latest relpersistence if the ALTER TABLE changes persistence as well.
Added a test (0002) which shows that ctx->rel has up-to-date
relpersistence. Also added a few other tests. Feel free to
include/reject them while committing.
0001 - same as your patch
0002 - additional tests
--
Best Wishes,
Ashutosh Bapat
Attachment | Content-Type | Size |
---|---|---|
0001-Fix-propagation-of-persistence-to-sequences-20240208.patch | text/x-patch | 3.8 KB |
0002-Additional-tests-20240208.patch | text/x-patch | 5.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Nisha Moond | 2024-02-08 06:14:05 | Re: Synchronizing slots from primary to standby |
Previous Message | Tom Lane | 2024-02-08 06:03:23 | Re: What about Perl autodie? |