Re: [PATCH] psql: add \dcs to list all constraints
Tatsuro Yamada <yamatattsu@gmail.com>
From: Tatsuro Yamada <yamatattsu@gmail.com>
To: Álvaro Herrera <alvherre@kurilemu.de>
Cc: Chao Li <li.evan.chao@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Jim Jones <jim.jones@uni-muenster.de>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-01-22T13:03:52Z
Lists: pgsql-hackers
Attachments
- v8-0001-Add-list-constraints-meta-command-dCN-on-psql.patch (application/octet-stream) patch v8-0001
Hi Chao, Álvaro, and all, >>I agree with another reviewer that said that having exec_command_d() >>check only the third char is kinda pointless. Just let >>listConstraints() check everything seems easiest and more consistent. > >As I mentioned in a previous email, the reason exec_command_d() only >checks the third character is that it follows the same implementation >pattern as other existing commands. > >While I agree that this could be improved, since the current behavior is >consistent with other commands, I do not consider it critical at the moment. >If I were to change it, I would likely postpone that improvement to a later >patch. After reviewing the code, I realized that the comment about passing everything to listconstraints() instead of just checking the third string was correct. Therefore, I updated the code accordingly. Thanks to Chao and Alvaro for their comments. I created the new patch (v8). Other fixes included: - Updated the documentation to clarify what the pattern string matches. - Modified the case statement to use a predefined variable when converting contypes to strings. Please find the attached file. Thanks, Tatsuro Yamada