Re: How to keep format of views source code as entered?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Adam Brusselback <adambrusselback(at)gmail(dot)com>
Cc: raf <raf(at)raf(dot)org>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: How to keep format of views source code as entered?
Date: 2021-01-14 05:22:58
Message-ID: CAKFQuwYWfqeZPNgTbNDfYK2iwPMYLULwW_sBvC2sQwxfK=eFUQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jan 13, 2021 at 6:40 PM Adam Brusselback <adambrusselback(at)gmail(dot)com>
wrote:

> It has been a major annoyance for views with complex subqueries or where
> clauses, the PG representation is absolutely unreadable.
>

The path to a solution here is to write a schema-to-text system that
presents the derived output in a more human-friendly way instead of a
machine-readable way. Or maybe write a formatter that takes the supposedly
unreadable output and does stuff like "change 'character varying' to
'text'".

In any case, though, what you can do is install the view in source into a
database, dump both, compare both (same version of PG), and decide whether
the database version is different from the source control version and, if
so, decide how to update the database. It's a view, it's not like you get
to do "alter" incremental changes anyway.

Or hold your nose and adopt a path of least resistance - accept what is
easy to accomplish and be glad you aren't writing more user-friendly stuff,
but that is only cosmetically different, yourself. Learning what the
canonical outputs mean is annoying but not hard, especially if you do have
an original human-readable document to answer questions.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paul Förster 2021-01-14 06:16:10 Re: How to keep format of views source code as entered?
Previous Message Laurenz Albe 2021-01-14 03:59:53 Re: How to keep format of views source code as entered?