Re: BUG #17879: ERROR: unrecognized node type: 2139062143
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: feichanghong@qq.com, pgsql-bugs@lists.postgresql.org
Date: 2023-03-30T10:54:15Z
Lists: pgsql-bugs
Attachments
- fix_generateSerialExtraStmts.patch (application/octet-stream) patch
On Thu, 30 Mar 2023 at 22:21, PG Bug reporting form <noreply@postgresql.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
Commits
-
Fix List memory issue in transformColumnDefinition
- 07554c99dfdb 11.20 landed
- 33510bc64919 12.15 landed
- 8d684c44511a 13.11 landed
- 2110162206b0 14.8 landed
- df567fbf6e41 15.3 landed
- 6c3b697b19db 16.0 landed