Re: PSQL Should \sv & \ev work with materialized views? - Mailing list pgsql-hackers

From Erik Wienhold
Subject Re: PSQL Should \sv & \ev work with materialized views?
Date
Msg-id ac4eoj5gcqxocgz66xlwfpqol7a5ln72kw7nk3yg544mig6ti4@emu5rtiomnz6
Whole thread Raw
In response to PSQL Should \sv & \ev work with materialized views?  (Kirk Wolak <wolakk@gmail.com>)
Responses Re: PSQL Should \sv & \ev work with materialized views?
List pgsql-hackers
On 2023-05-15 06:32 +0200, Kirk Wolak wrote:
> Personally I would appreciate it if \sv actually showed you the DDL.
> Oftentimes I will \ev something to review it, with syntax highlighting.

+1.  I was just reviewing some matviews and was surprised that psql
lacks commands to show their definitions.

But I think that it should be separate commands \sm and \em because we
already have commands \dm and \dv that distinguish between matviews and
views.

> This should not be that difficult.  Just looking for feedback.
> Admittedly \e is questionable, because you cannot really apply the changes.
> ALTHOUGH, I would consider that I could
> BEGIN;
> DROP MATERIALIZED VIEW ...;
> CREATE MATERIALIZED VIEW ...;
> 
> Which I had to do to change the WITH DATA so it creates with data when we
> reload our object.s

I think this could even be handled by optional modifiers, e.g. \em emits
CREATE MATERIALIZED VIEW ... WITH NO DATA and \emD emits WITH DATA.
Although I wouldn't mind manually changing WITH NO DATA to WITH DATA.

-- 
Erik



pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: [PoC] Federated Authn/z with OAUTHBEARER
Next
From: Alexander Korotkov
Date:
Subject: Re: [HACKERS] make async slave to wait for lsn to be replayed