pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Jeff Davis <pgsql@j-davis.com>
To: pgsql-bugs@postgresql.org
Subject: pg_dump assertion failure with "-n pg_catalog"
Date: Wed, 07 Jun 2023 10:36:29 -0700
Message-ID: <ce071503fee88334aa70f360e6e4ea14d48305ee.camel@j-davis.com> (raw )
On version 15 or later:
pg_dump -n pg_catalog postgres > /dev/null
pg_dump: pg_dump.c:13291: dumpCollation: Assertion `collcollate !=
((void *)0)' failed.
Patch attached.
I tried adding a test, but dumping pg_catalog seems to only be
supported for research purposes, so it's not clear what the test should
be testing.
If we went almost two release cycles without anyone noticing, then
perhaps we should just get rid of the ability to dump pg_catalog. But I
think the attached patch clarifies things regardless.
--
Jeff Davis
PostgreSQL Contributor Team - AWS
Attachments:
0001-Fix-pg_dump-assertion-failure-when-dumping-pg_catalo.patch (text/x-patch, 1.9K) download
From 2359f3244cc30bbc3353b8644e25879d8ae87c20 Mon Sep 17 00:00:00 2001
From: Jeff Davis <jeff@j-davis.com>
Date: Wed, 7 Jun 2023 10:32:52 -0700
Subject: [PATCH] Fix pg_dump assertion failure when dumping pg_catalog.
---
src/bin/pg_dump/pg_dump.c | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 5dab1ba9ea..2a6a321609 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -13446,13 +13446,34 @@ dumpCollation(Archive *fout, const CollInfo *collinfo)
if (strcmp(PQgetvalue(res, 0, i_collisdeterministic), "f") == 0)
appendPQExpBufferStr(q, ", deterministic = false");
- if (colliculocale != NULL)
+ if (collprovider[0] == 'd')
{
+ Assert(colliculocale == NULL);
+ Assert(collicurules == NULL);
+ Assert(collcollate == NULL);
+ Assert(collctype == NULL);
+
+ /* no locale -- the default collation cannot be reloaded anyway */
+ }
+ else if (collprovider[0] == 'i')
+ {
+ Assert(colliculocale != NULL);
+ Assert(collcollate == NULL);
+ Assert(collctype == NULL);
+
appendPQExpBufferStr(q, ", locale = ");
appendStringLiteralAH(q, colliculocale, fout);
+
+ if (collicurules)
+ {
+ appendPQExpBufferStr(q, ", rules = ");
+ appendStringLiteralAH(q, collicurules, fout);
+ }
}
- else
+ else if (collprovider[0] == 'c')
{
+ Assert(colliculocale == NULL);
+ Assert(collicurules == NULL);
Assert(collcollate != NULL);
Assert(collctype != NULL);
@@ -13469,12 +13490,8 @@ dumpCollation(Archive *fout, const CollInfo *collinfo)
appendStringLiteralAH(q, collctype, fout);
}
}
-
- if (collicurules)
- {
- appendPQExpBufferStr(q, ", rules = ");
- appendStringLiteralAH(q, collicurules, fout);
- }
+ else
+ pg_fatal("unrecognized collation provider '%c'", collprovider[0]);
/*
* For binary upgrade, carry over the collation version. For normal
--
2.34.1
view thread (8+ messages) latest in thread
Message-ID: <ce071503fee88334aa70f360e6e4ea14d48305ee.camel@j-davis.com>
Permalink: ../ce071503fee88334aa70f360e6e4ea14d48305ee.camel@j-davis.com/
Also on: postgresql.org/message-id/ce071503fee88334aa70f360e6e4ea14d48305ee.camel@j-davis.com
copy link · copy postgr.es · copy git am
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-bugs@postgresql.org
Cc: pgsql@j-davis.com
Subject: Re: pg_dump assertion failure with "-n pg_catalog"
In-Reply-To: <ce071503fee88334aa70f360e6e4ea14d48305ee.camel@j-davis.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