BUG #17879: ERROR: unrecognized node type: 2139062143

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: feichanghong(at)qq(dot)com
Subject: BUG #17879: ERROR: unrecognized node type: 2139062143
Date: 2023-03-30 02:36:25
Message-ID: 17879-b7dfb5debee58ff5@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17879
Logged by: Fei Changhong
Email address: feichanghong(at)qq(dot)com
PostgreSQL version: 15.2
Operating system: CentOS7 with kernel version 5.10
Description:

We have noticed that an error "ERROR: unrecognized node type:2139062143"
occurs when creating a table with a SEQUENCE column after an event trigger
of type ddl_command_end has already been created. This error can be
reproduced using the following SQL statement, and please note that the
"--enable-cassert" option must be included during configuration.
···
-- CREATE EVENT TRIGGER
CREATE TABLE mytable (id serial primary key, name text);
CREATE OR REPLACE FUNCTION log_ddl_commands() RETURNS event_trigger AS $$
DECLARE
obj record;
BEGIN
FOR obj IN SELECT * FROM pg_event_trigger_ddl_commands() WHERE command_tag
<> 'SELECT' LOOP
RAISE NOTICE 'Command: % Object: %', obj.command_tag,
obj.object_identity;
END LOOP;
END;
$$ LANGUAGE plpgsql;
CREATE EVENT TRIGGER ddl_log_trigger ON ddl_command_end EXECUTE FUNCTION
log_ddl_commands();
-- Create a table with a SEQUENCE column
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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2023-03-30 03:00:23 Re: A structure has changed but comment modifications maybe missed
Previous Message Tom Lane 2023-03-30 02:02:09 Re: A structure has changed but comment modifications maybe missed