From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Imseih (AWS), Sami" <simseih(at)amazon(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: [BUG] pg_dump does not properly deal with BEGIN ATOMIC function |
Date: | 2023-06-02 12:16:16 |
Message-ID: | 49272.1685708176@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
"Imseih (AWS), Sami" <simseih(at)amazon(dot)com> writes:
> 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
Hmph. The other thing worth noticing is that pg_dump prints
a warning:
pg_dump: warning: could not resolve dependency loop among these items:
or with -v:
pg_dump: warning: could not resolve dependency loop among these items:
pg_dump: FUNCTION a_f (ID 218 OID 40664)
pg_dump: CONSTRAINT a_pkey (ID 4131 OID 40663)
pg_dump: POST-DATA BOUNDARY (ID 4281)
pg_dump: TABLE DATA a (ID 4278 OID 40657)
pg_dump: PRE-DATA BOUNDARY (ID 4280)
So it's lacking a rule to tell it what to do in this case, and the
default is the wrong way around. I think we need to fix it in
about the same way as the equivalent case for matviews, which
leads to the attached barely-tested patch.
BTW, now that I see a case the default printout here seems
completely ridiculous. I think we need to do
pg_log_warning("could not resolve dependency loop among these items:");
for (i = 0; i < nLoop; i++)
{
char buf[1024];
describeDumpableObject(loop[i], buf, sizeof(buf));
- pg_log_info(" %s", buf);
+ pg_log_warning(" %s", buf);
}
but I didn't actually change that in the attached.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
dump-loop-fix.patch | text/x-patch | 3.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Terry Brennan | 2023-06-02 12:17:01 | Re: Request for new function in view update |
Previous Message | Daniel Gustafsson | 2023-06-02 08:35:43 | Re: Cutting support for OpenSSL 1.0.1 and 1.0.2 in 17~? |