On 2025-Jul-18, jian he wrote: > one minor issue in getDomainConstraints: > > for (int i = 0, j = 0; i < ntups; i++) > { > char contype = (PQgetvalue(res, i, i_contype))[0]; > .... > constraint->contype = *(PQgetvalue(res, i, i_contype)); > } > > for the same code simplicity, > ``constraint->contype = *(PQgetvalue(res, i, i_contype));`` > can change to > `` constraint->contype = contype; `` > ? > other than that, looks good to me.
Thanks, changed it that way. I noticed some other issues however. First, you had removed the contype comparisons in repairDependencyLoop; I put them back several versions of the patch ago, but I had mistakenly made them reference the wrong array item -- in all three places. Doh. Second, the name comparisons to determine whether to list the constraint name in the "CREATE DOMAIN .. NOT NULL" syntax was wrong: it was using fmtId() around the constraint name, but of course that would have never worked, because we're comparing to the original string, not a quoted name. So if you had a domain called, say CREATE DOMAIN "my domain" AS int NOT NULL; then pg_dump would have said CREATE DOMAIN "my domain" AS int CONSTRAINT "my domain_not_null" NOT NULL; even though listing the name is unnecessary. This wouldn't have made the dump fail, so it's borderline; but it would be /slightly/ ugly. Lastly, I made dumpDomain print unadorned "NOT NULL" if a pg_constraint row for the constraint is not found and yet we observe typnotnull set. This can be considered catalog corruption (the row should be there), but I think this is better than having pg_dump just crash if that row is not there. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ Voy a acabar con todos los humanos / con los humanos yo acabaré voy a acabar con todos (bis) / con todos los humanos acabaré ¡acabaré! (Bender)