Re: Add psql command to list constraints

From: Tatsuro Yamada <tatsuro(dot)yamada(dot)tf(at)nttcom(dot)co(dot)jp>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add psql command to list constraints
Date: 2021-11-16 03:47:31
Message-ID: 14bf186c-f3f6-ffae-d324-4abd4d9f05a2@nttcom.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Justin,

Thanks for your comments!


>> Currently, DBAs need the table name to see the constraint information.
>
> Or, they can query pg_constraint or information_schema: check_constraints,
> table_constraints.

Yeah, right.
If they can use the meta-command instead of a long query against pg_constraint
or information_schema and also pg_attribulte, it would be helpful, I believe. :-D

>> - success = listConversions(pattern, show_verbose, show_system);
>> + if (strncmp(cmd, "dco", 3) == 0) /* Constraint */
>> + switch (cmd[3])
>> + {
>> + case '\0':
>> + case '+':
>
> Does "+" do anything ?

No, it doesn't. Removed.


>> +++ b/src/bin/psql/help.c
>> @@ -231,6 +231,7 @@ slashUsage(unsigned short int pager)
>
>> fprintf(output, _(" \\db[+] [PATTERN] list tablespaces\n"));
>> fprintf(output, _(" \\dc[S+] [PATTERN] list conversions\n"));
>> + fprintf(output, _(" \\dco[S] [PATTERN] list constraint\n"));
>
> Should be plural "constraints".
>
> I think "exclude" should be called "exclusion" ("exclude" sounded to me like
> you're going to provide a way to "exclude" types of constraints, like "xc"
> would show everything except check constraints).

Thanks! Fixed the both.

Attached file is new patch. It includes:

- Fix help message s/constraint/constraints/
- s/Exclude/Exclusion/
- Remove unused modifier "+"
- Add document for \dco

Thanks,
Tatsuro Yamada

Attachment Content-Type Size
0001-Add-psql-command-to-list-constraints-POC3.patch text/plain 7.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2021-11-16 04:04:25 Re: pg_waldump stucks with options --follow or -f and --stats or -z
Previous Message Michael Paquier 2021-11-16 03:13:51 Re: add recovery, backup, archive, streaming etc. activity messages to server logs along with ps display