Re: pg_event_trigger_ddl_commands fails with cache lookup failed

From: Sven Klemm <sven(at)timescale(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: pg_event_trigger_ddl_commands fails with cache lookup failed
Date: 2021-02-28 00:30:18
Message-ID: CAMCrgp0YmUuxoTaWrVLzA34-L_SLxUQo62w=bOsVr=my3JnoJw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Oh sorry, the steps to reproduce were in the initial mail and i didnt
add them again.
This fails on master too. The drop identity drops the sequence which means
pg_event_trigger_ddl_commands cannot lookup details for the sequence.
This still fails on master.

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;

On Sun, Feb 28, 2021 at 1:21 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Sven Klemm <sven(at)timescale(dot)com> writes:
> >> 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
>
> This is not what I'd call an adequate bug report. I guessed at what you
> might have started from, but it works for me:
>
> regression=# create table t (f1 int generated always as identity);
> CREATE TABLE
> regression=# ALTER TABLE t ALTER COLUMN f1 DROP IDENTITY, ALTER COLUMN f1 SET
> DATA TYPE bigint;
> ALTER TABLE
>
> Having said that, this seems like it's in the same ball park as some
> not-very-long-ago bug fixes in ALTER TABLE's sequence of operations.
> Maybe you just need to update.
>
> regards, tom lane

--
Regards, Sven Klemm

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-02-28 00:35:23 Re: pg_event_trigger_ddl_commands fails with cache lookup failed
Previous Message Tom Lane 2021-02-28 00:20:59 Re: pg_event_trigger_ddl_commands fails with cache lookup failed