pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Imseih (AWS), Sami <simseih@amazon.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: [BUG] pg_dump does not properly deal with BEGIN ATOMIC function
Date: Wed, 31 May 2023 21:51:25 +0000
Message-ID: <2C1933AB-C2F8-499B-9D18-4AC1882256A0@amazon.com> (raw)

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)



Attachments:

  [application/octet-stream] repro.sh (568B, ../2C1933AB-C2F8-499B-9D18-4AC1882256A0@amazon.com/3-repro.sh)
  download

view thread (18+ messages)  latest in thread

Message-ID: <2C1933AB-C2F8-499B-9D18-4AC1882256A0@amazon.com>
Permalink:  ../2C1933AB-C2F8-499B-9D18-4AC1882256A0@amazon.com/
Also on:    postgresql.org/message-id/2C1933AB-C2F8-499B-9D18-4AC1882256A0@amazon.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: simseih@amazon.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: [BUG] pg_dump does not properly deal with BEGIN ATOMIC function
  In-Reply-To: <2C1933AB-C2F8-499B-9D18-4AC1882256A0@amazon.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox