Re: [PATCH] psql: add \dcs to list all constraints - Mailing list pgsql-hackers

From Chao Li
Subject Re: [PATCH] psql: add \dcs to list all constraints
Date
Msg-id FDE935A4-8045-4E8A-8D2A-F542CCC89251@gmail.com
Whole thread Raw
In response to Re: [PATCH] psql: add \dcs to list all constraints  (Tatsuro Yamada <yamatattsu@gmail.com>)
Responses Re: [PATCH] psql: add \dcs to list all constraints
List pgsql-hackers

> On Jan 15, 2026, at 17:20, Tatsuro Yamada <yamatattsu@gmail.com> wrote:
>
> Hi Chao-san,
>
> Thanks for your comments!
>
> On Thu, Jan 15, 2026 at 4:20 PM Chao Li <li.evan.chao@gmail.com> wrote:
>
> >3
> >```
> >---- \dCN doesn't show constraints related to domain,
> >---- since \dD can be used to check them
> >```
> >
> >I saw this in the test script, should we mention that in the doc change?
>
> Tom also commented on constraints related to domains, and I would like to
> discuss and decide whether to include them in the \dCN command.
>
> Depending on the decision, I am considering the following changes:
>
> - If they are included:
>     - Remove the above test case from the regression tests
> - If they are not included:
>     - Add the reason for excluding them to the documentation
>
> Which do you think is better? Should domain constraints be covered by \dCN?
> I would appreciate your feedback.

I had a feeling while reviewing the patch but I didn’t raise it because I was not firm minded. As you ask, this is just
mypersonal opinion, you may ignore if you don’t consider reasonable. 

This patch claims “constraints”, but it actually only shows table constraints. How, we can see the code comment says
"Describesconstraints”, the command message says "List of constraints”, I think that’s where the discussion came from. 

Maybe an easy way to go is something like renaming the command to \dTCN, making it specific to table constraints.

>
> >6
> >```
> >+       if (!(showCheck || showForeign || showNotnull || showPrimary || showTrigger || showUnique || showExclusion))
> >+               showAllkinds = true;
> >```
> >
> >Nit: this might be simplified as: showAllkinds = !(showCheck || …), then you don’t need to initialize showAllkinds
asfalse. 
>
> Personally, I do not think there is any major issue with the current code,
> but since you suggested it, I will simplify it.
>

Yeah, I marked it as “nit”.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/







pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: Refactor replication origin state reset helpers
Next
From: Masahiko Sawada
Date:
Subject: Re: Optimize SnapBuildPurgeOlderTxn: use in-place compaction instead of temporary array