Re: PSQL Should \sv & \ev work with materialized views?

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: Kirk Wolak <wolakk(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: PSQL Should \sv & \ev work with materialized views?
Date: 2024-03-28 23:02:11
Message-ID: ac4eoj5gcqxocgz66xlwfpqol7a5ln72kw7nk3yg544mig6ti4@emu5rtiomnz6
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2024-03-28 23:15:13 Re: [HACKERS] make async slave to wait for lsn to be replayed
Previous Message Daniel Gustafsson 2024-03-28 22:34:02 Re: [PoC] Federated Authn/z with OAUTHBEARER