[BUG] pg_dump does not properly deal with BEGIN ATOMIC function

From: "Imseih (AWS), Sami" <simseih(at)amazon(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [BUG] pg_dump does not properly deal with BEGIN ATOMIC function
Date: 2023-05-31 21:51:25
Message-ID: 2C1933AB-C2F8-499B-9D18-4AC1882256A0@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

What appears to be a pg_dump/pg_restore bug was observed with the new
BEGIN ATOMIC function body syntax introduced in Postgres 14.

Dependencies inside a BEGIN ATOMIC function cannot be resolved
if those dependencies are dumped after the function body. The repro
case is when a primary key constraint is used in a ON CONFLICT ON CONSTRAINT
used within the function.

With the attached repro, pg_restore fails with

pg_restore: error: could not execute query: ERROR: constraint "a_pkey" for table "a" does not exist
Command was: CREATE FUNCTION public.a_f(c1_in text, c2 integer DEFAULT 60) RETURNS void

I am not sure if the answer if to dump functions later on in the process.

Would appreciate some feedback on this issue.

Regards,

Sami Imseih
Amazon Web Services (AWS)

Attachment Content-Type Size
repro.sh application/octet-stream 568 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2023-05-31 23:35:34 Re: ALTER TABLE SET ACCESS METHOD on partitioned tables
Previous Message Peter Eisentraut 2023-05-31 21:24:01 Re: generate syscache info automatically