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

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: "Markhof, Ingolf" <ingolf(dot)markhof(at)de(dot)verizon(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, 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-09 15:09:26
Message-ID: 33A6B3F2-D21E-4826-9758-282D2AE1B30D@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Jan 9, 2021, at 06:22, Markhof, Ingolf <ingolf(dot)markhof(at)de(dot)verizon(dot)com> wrote:
> What I would like to have is something that would automatically update the SQL code in the software repository when I run a CREATE OR REPLACE VIEW.

I think you are approaching this backwards. The SQL in the repository should be the definitive version. If you wish to change the view, you change the CREATE OR REPLACE VIEW command that you have stored in the repository, and then apply that to the database so it now has the new view definition.

You may not, in a small independent project, feel the need for a source code repository, but it becomes very useful very quickly.

--
-- Christophe Pettus
xof(at)thebuild(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jack Orenstein 2021-01-09 15:50:24 Static memory, shared memory
Previous Message David G. Johnston 2021-01-09 14:49:04 Select a column and then apply JSONB_ARRAY_ELEMENTS to it