pg_event_trigger_ddl_commands fails with cache lookup failed - Mailing list pgsql-bugs

From Sven Klemm
Subject pg_event_trigger_ddl_commands fails with cache lookup failed
Date
Msg-id CAMCrgp39V7JQA_Gc+JaEZV3ALOU1ZG=Pwyk3oDpTq7F6Z0JSmg@mail.gmail.com
Whole thread Raw
List pgsql-bugs
Hello,

when creating an event trigger for ddl_command_end that calls
pg_event_trigger_ddl_commands certain statements will cause the
trigger to fail with a cache lookup error. The error happens on 12.5
and 13.2 i didnt test any other versions.

trg=# ALTER TABLE t ALTER COLUMN f1 DROP IDENTITY, ALTER COLUMN f1 SET
DATA TYPE bigint;
ERROR:  XX000: cache lookup failed for relation 13476892
CONTEXT:  PL/pgSQL function ddl_end() line 5 at FOR over SELECT rows
LOCATION:  getRelationTypeDescription, objectaddress.c:4178

To reproduce:
CREATE OR REPLACE FUNCTION ddl_end()
  RETURNS event_trigger AS $$
DECLARE
  r RECORD;
BEGIN
  FOR r IN SELECT * FROM pg_event_trigger_ddl_commands()
  LOOP
    RAISE NOTICE 'ddl_end: % %', r.command_tag, r.object_type;
  END LOOP;
END;
$$ LANGUAGE plpgsql;

CREATE EVENT TRIGGER ddl_end ON ddl_command_end EXECUTE PROCEDURE ddl_end();

CREATE TABLE t(f1 int NOT NULL GENERATED ALWAYS AS IDENTITY);
ALTER TABLE t ALTER COLUMN f1 DROP IDENTITY, ALTER COLUMN f1 SET DATA
TYPE bigint;

-- 
Regards, Sven Klemm



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #16864: cache lookup failed for relation 1255
Next
From: Tom Lane
Date:
Subject: Re: Unexpected serialization error