On 2025-Jun-26, Fujii Masao wrote:

> However, with the patch applied, I encountered a segmentation fault in pg_dump
> as follows:

Ah, thanks for the test case.  Yeah, I removed one 'if' condition too
many from Jian's patch.  We just need to test the constraint name for
nullness and then things seem to work:

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 5dd1f42631d..7b5024d4f71 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -17719,7 +17719,8 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo)
 
                for (j = 0; j < tbinfo->numatts; j++)
                {
-                       if (tbinfo->notnull_comment[j] != NULL)
+                       if (tbinfo->notnull_constrs[j] != NULL &&
+                               tbinfo->notnull_comment[j] != NULL)
                        {
                                if (comment == NULL)
                                {

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/


Reply via email to