From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
---|---|
To: | feichanghong(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #17879: ERROR: unrecognized node type: 2139062143 |
Date: | 2023-03-30 10:54:15 |
Message-ID: | CAApHDvrFOjY9-6=mqx4r9YO7HoXdZ_5jsuiS0FFGfWC8YrJ7yA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Thu, 30 Mar 2023 at 22:21, PG Bug reporting form
<noreply(at)postgresql(dot)org> wrote:
> CREATE TABLE mytable1(id INT GENERATED ALWAYS AS IDENTITY (SEQUENCE NAME
> test_seq));
> We have identified the root cause as follows:
> In the generateSerialExtraStmts function, the memory space for the seqoption
> list has been freed, but the options member of the Constraint still points
> to that memory address, which caused an error during the copyObject
> operation in the EventTriggerCollectSimpleCommand function.
Thank you for the detailed report and reproducer.
The problem seems to be down to generateSerialExtraStmts() deleting a
cell out of the given seqoptions resulting in that becoming an empty
list, but the calling function does not have its list pointer set to
NIL.
I see a few ways to fix; 1) always make a list_copy() of the list
before calling generateSerialExtraStmts(), or; 2) make a copy of the
list inside generateSerialExtraStmts() unconditionally, or 3) at the
very least, just make a copy before calling list_delete_nth_cell().
#1 and #2 might be a bit more effort than is really required, so the
attached does #3.
David
Attachment | Content-Type | Size |
---|---|---|
fix_generateSerialExtraStmts.patch | application/octet-stream | 728 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-03-30 11:47:29 | Re: BUG #16329: Valgrind detects an invalid read when building a gist index with buffering |
Previous Message | Alvaro Herrera | 2023-03-30 09:57:40 | Re: BUG #17877: Referencing a system column in a foreign key leads to incorrect memory access |