Re: psql: add \si, \sm, \st and \sr functions to show CREATE commands for indexes, matviews, triggers and tables

From: Anna Akenteva <a(dot)akenteva(at)postgrespro(dot)ru>
To: a(dot)pervushina(at)postgrespro(dot)ru
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql: add \si, \sm, \st and \sr functions to show CREATE commands for indexes, matviews, triggers and tables
Date: 2020-08-11 10:37:10
Message-ID: 52331028ead62418c4a883c07e3a7ff1@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-07-28 20:46, a(dot)pervushina(at)postgrespro(dot)ru wrote:
> I've attached a patch that implements \si, \sm, \st and \sr functions
> that show the CREATE command for indexes, matviews, triggers and
> tables. The functions are implemented similarly to the existing sf/sv
> functions with some modifications.
>
To me these functions seem useful.
As for adding them to server side, I don't see a big need for it. It
feels more logical to follow the already eatablished pattern for the
\s[...] commands.

About the patch:

1) There is some code duplication for the exec_command_[sm|si|st|sr]
functions. Plus, it seems weird to separate sm (show matview) from sv
(show view). Perhaps it would be more convenient to combine some of the
code? Maybe by editing the already-existing exec_command_sf_sv()
function.

2) Seeing how \s and \e functions were added together, I'm wondering -
should there be \e functions too for any objects affected by this patch?

--
Anna Akenteva
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2020-08-11 11:15:44 Re: Make contrib modules' installation scripts more secure.
Previous Message Masahiko Sawada 2020-08-11 10:03:19 Re: Add information to rm_redo_error_callback()