Re: Preserving the source code of views

From: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Brian Crowell <brian(at)fluggo(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Preserving the source code of views
Date: 2013-10-21 15:52:24
Message-ID: CAB8KJ=h9jvDou0Y+tifuJq+bTO5sLZQhmUjQGA=H45RhuFibpQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2013/10/22 Stephen Frost <sfrost(at)snowman(dot)net>:

>> You also mentioned an external CMS. Any suggestions?
>
> I'm a big fan of git, but if you really want to keep things in-database
> and track dependencies, etc, it occurs to me that you might be able to
> use an actual table in the database to store the raw form of your view
> definitions and then have an SP or something which can link up that
> table to the actual views in the database and then you can look at
> dependencies through the PG system catalogs...
>
> Haven't really thought this through completely, but wanted to mention
> the idea as it might help you.

At my current workplace, view definitions (which are very old-school with
revision history etcetera recorded in comments) are stored in PL/PgSQL functions
which are updated and executed whenever views are modified. I'm looking at
adding a wrapper function to automatically detect and recreate dependencies,
not sure how well that would work. We keep track of schema changes via
pg_extractor[1] which integrates quite nicely with GIT.

[1] https://github.com/omniti-labs/pg_extractor

Regards

Ian Barwick

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ben 2013-10-21 16:17:01 Re: pg_dump resulting in excessive memory use by postmaster process
Previous Message Stephen Frost 2013-10-21 15:36:46 Re: pg_dump resulting in excessive memory use by postmaster process