Thread: SQL code versioning (views, functions, etc)

SQL code versioning (views, functions, etc)

From
Ezequiel Tolnay
Date:
Hi all you pg gurus and admins,

   I'm trying to implement versioning of the code of objects that can be
"created or replaced" (functions, views, etc).

   I tried to implement a trigger on pg_proc, but that is not possible.
Adding a rule to the pg_proc table was successful but it never executes.

   Is there a way or a tool to implement versioning of the code of this
objects? Help or hints will be gladly appreciated.

Cheers,

Ezequiel Tolnay
etolnay@gbtech.com.au

Re: SQL code versioning (views, functions, etc)

From
Ezequiel Tolnay
Date:
I just discovered that in the public schema (which I don't use) there is
a table pg_version_history. Does anyone know about this table?

It has versions of two test functions I seem to have created a couple of
months ago when I first installed postgresql, but I have no idea how
this table was created or what is its purpose, since although it seems
to be used to keep track of changes of function code (which is what I'm
looking for) it only has these two test functions, and I've created many
using different software.

Re: SQL code versioning (views, functions, etc)

From
Tom Lane
Date:
Ezequiel Tolnay <mail@etolnay.com.ar> writes:
>    I tried to implement a trigger on pg_proc, but that is not possible.
> Adding a rule to the pg_proc table was successful but it never executes.

Sorry, we don't support either rules or triggers on the system catalogs.

            regards, tom lane