Re: pg_dump does not dump domain not-null constraint's comments

2025-07-21 Thread Álvaro Herrera
On 2025-Jul-18, jian he wrote: > one minor issue in getDomainConstraints: > > for (int i = 0, j = 0; i < ntups; i++) > { > charcontype = (PQgetvalue(res, i, i_contype))[0]; > > constraint->contype = *(PQgetvalue(res, i, i_contype)); > } > > for the same code

Re: pg_dump does not dump domain not-null constraint's comments

2025-07-18 Thread jian he
On Fri, Jul 18, 2025 at 5:11 AM Álvaro Herrera wrote: > > Anyway, here's a patch. > one minor issue in getDomainConstraints: for (int i = 0, j = 0; i < ntups; i++) { charcontype = (PQgetvalue(res, i, i_contype))[0]; constraint->contype = *(PQgetvalue(res, i,

Re: pg_dump does not dump domain not-null constraint's comments

2025-07-17 Thread Álvaro Herrera
On 2025-Jul-15, jian he wrote: > we should let: > dumpConstraint handles dumping separate "NOT VALID" domain constraints along > with their comments. > dumpDomain: handles dumping "inlined" valid (not separate) domain constraints > together with their comments. Hmm, okay, but not-null constraints

Re: pg_dump does not dump domain not-null constraint's comments

2025-07-15 Thread Álvaro Herrera
On 2025-Jul-15, jian he wrote: > On Tue, Jul 15, 2025 at 2:10 PM jian he wrote: > > accidently found another existing bug. > > CREATE SCHEMA test; > > CREATE DOMAIN test.d1 AS integer NOT NULL DEFAULT 11; > > COMMENT ON CONSTRAINT a2 ON DOMAIN test.d1 IS 'test'; > > ALTER DOMAIN test.d1 > >

Re: pg_dump does not dump domain not-null constraint's comments

2025-07-15 Thread jian he
On Tue, Jul 15, 2025 at 2:10 PM jian he wrote: > > accidently found another existing bug. > > create schema test; > CREATE DOMAIN test.d1 AS integer NOT NULL default 11; > alter domain test.d1 add constraint a2 check(value > 1) not valid; > comment on CONSTRAINT a2 ON DOMAIN test.d1 is 'test'; > d

Re: pg_dump does not dump domain not-null constraint's comments

2025-07-14 Thread jian he
On Tue, Jul 15, 2025 at 2:24 AM Álvaro Herrera wrote: > > On 2025-May-22, jian he wrote: > > > I actually found another bug. > > create schema test; > > CREATE DOMAIN test.d1 AS integer NOT NULL default 11; > > pg_dump --schema=test > 1.sql > > "" > > pg_dump: warning: could not resolve dependenc

Re: pg_dump does not dump domain not-null constraint's comments

2025-07-14 Thread Tom Lane
=?utf-8?Q?=C3=81lvaro?= Herrera writes: > I wonder to what extent we promise ABI compatibility of pg_dump.h > structs in stable branches. Those should be private to pg_dump, so I see no objection to changing them. regards, tom lane

Re: pg_dump does not dump domain not-null constraint's comments

2025-07-14 Thread Álvaro Herrera
On 2025-May-22, jian he wrote: > I actually found another bug. > create schema test; > CREATE DOMAIN test.d1 AS integer NOT NULL default 11; > pg_dump --schema=test > 1.sql > "" > pg_dump: warning: could not resolve dependency loop among these items: > pg_dump: detail: TYPE d1 (ID 1415 OID 18007

Re: pg_dump does not dump domain not-null constraint's comments

2025-05-22 Thread jian he
hi. "Catalog domain not-null constraints" commit[1] doesn't have a pg_dump test. I actually found another bug. create schema test; CREATE DOMAIN test.d1 AS integer NOT NULL default 11; pg_dump --schema=test > 1.sql "" pg_dump: warning: could not resolve dependency loop among these items: pg_dump

Re: pg_dump does not dump domain not-null constraint's comments

2025-05-07 Thread jian he
On Wed, May 7, 2025 at 10:56 PM Álvaro Herrera wrote: > > Ooh, you know what? I ran your the CREATE DOMAIN statement in your new > test and pg_dump'ed that, and as far as I can tell the _name_ of the > not-null constraint is not dumped either. So it's not just the comment > that we're losing. T

Re: pg_dump does not dump domain not-null constraint's comments

2025-05-07 Thread Álvaro Herrera
Ooh, you know what? I ran your the CREATE DOMAIN statement in your new test and pg_dump'ed that, and as far as I can tell the _name_ of the not-null constraint is not dumped either. So it's not just the comment that we're losing. That's a separate bug, and probably needs to be fixed first, altho

Re: pg_dump does not dump domain not-null constraint's comments

2025-05-07 Thread jian he
ump test, I have added some changes on src/bin/pg_dump/t/002_pg_dump.pl, but it fails the tests v2-0001 ensures pg_dump dump domain not-null constraint's comments v2-0002 change some variable/argument/struct element name because of v2-0001. From e1f94b2b1f21ca8f285b40efe87e1ed64e52b0d1 Mon Sep 17

Re: pg_dump does not dump domain not-null constraint's comments

2025-05-07 Thread Álvaro Herrera
On 2025-May-07, jian he wrote: > in PG17 and master, pg_dump (--schema=test --no-owner) > [...] > didn't produce > COMMENT ON CONSTRAINT nn ON DOMAIN test.d1 IS 'not null constraint on > domain d1'; > we should make pg_dump to produce it too? Yes, this is clearly a pg17 bug whose fix should be ba

pg_dump does not dump domain not-null constraint's comments

2025-05-07 Thread jian he
:00:00 2001 From: jian he Date: Wed, 7 May 2025 16:59:35 +0800 Subject: [PATCH v1 1/1] pg_dump does not dump domain not-null constraint's comments this patch trying to resolve this issue. discussion: https://postgr.es/m/ --- src/bin/pg_dump/pg_dump.c | 66 ++-