Re: pg_dump misses comments on NOT NULL constraints - Mailing list pgsql-hackers

From Álvaro Herrera
Subject Re: pg_dump misses comments on NOT NULL constraints
Date
Msg-id 202506251336.qzlvt5yaz2cs@alvherre.pgsql
Whole thread Raw
In response to Re: pg_dump misses comments on NOT NULL constraints  (Álvaro Herrera <alvherre@kurilemu.de>)
Responses Re: pg_dump misses comments on NOT NULL constraints
List pgsql-hackers
On 2025-Jun-25, Álvaro Herrera wrote:

> Yeah, I think in this case we need to extract the constraint name so
> that we have it available to print the COMMENT command, rather than
> making any assumptions about it.  In fact I suspect this would fail if
> the table or column names are very long.  For the other pg_dump uses of
> this logic it doesn't matter AFAIR, but here I think we must be
> stricter.

As attached.

I'm bothered by this not having any tests -- I'll see about adding some
after lunch.  But at least, this seems to be dumped correctly:

CREATE TABLE supercallifragilisticexpialidocious ("dociousaliexpilistic fragilcalirupus" int not null);
COMMENT ON CONSTRAINT "supercallifragilisticexpial_dociousaliexpilistic fragi_not_null" ON
public.supercallifragilisticexpialidociousIS 'long names, huh?';
 

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/

Attachment

pgsql-hackers by date:

Previous
From: Álvaro Herrera
Date:
Subject: Re: pg_dump misses comments on NOT NULL constraints
Next
From: Sergey Shinderuk
Date:
Subject: Re: Read-Write optimistic lock (Re: sinvaladt.c: remove msgnumLock, use atomic operations on maxMsgNum)