On Wed, Jan 13, 2021 at 6:40 PM Adam Brusselback <adambrusselback@xxxxxxxxx> 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.