Hello Alvaro,

It looks like pg_dump emits incorrect text for domain constraint comments:

Assuming the following structure,

CREATE DOMAIN "dom" AS integer
        CONSTRAINT "dom_constraint" CHECK ((VALUE > 10));

COMMENT ON CONSTRAINT "dom_constraint" ON DOMAIN "dom" IS 'domain constraint 
comment'

pg_dump will dump the COMMENT as follow:

COMMENT ON CONSTRAINT "dom_constraint" ON DOMAIN """dom""" IS 'domain 
constraint comment'

Note the double-quoting issue of the domain name.

Attached patch fixes that.

                                    Elvis
>From ce1d4984dc0fb12082d89282acb674f5597404f1 Mon Sep 17 00:00:00 2001
From: Elvis Pranskevichus <el...@magic.io>
Date: Mon, 11 Jan 2016 17:30:54 -0500
Subject: [PATCH] pg_dump: Fix dumping of comments on domain constraints

---
 src/bin/pg_dump/pg_dump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 56c0528..00ffcac 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -9485,7 +9485,7 @@ dumpDomain(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo)
 		appendPQExpBuffer(labelq, "CONSTRAINT %s ",
 						  fmtId(domcheck->dobj.name));
 		appendPQExpBuffer(labelq, "ON DOMAIN %s",
-						  fmtId(qtypname));
+						  qtypname);
 		dumpComment(fout, dopt, labelq->data,
 					tyinfo->dobj.namespace->dobj.name,
 					tyinfo->rolname,
-- 
2.4.10

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to