Re: Anyone working on pg_dump dependency ordering? - Mailing list pgsql-hackers

From prinsarian@zonnet.nl (Arian Prins)
Subject Re: Anyone working on pg_dump dependency ordering?
Date
Msg-id 254336a1.0311250039.4ae8803a@posting.google.com
Whole thread Raw
In response to Anyone working on pg_dump dependency ordering?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
chriskl@familyhealth.com.au (Christopher Kings-Lynne) wrote in message news:<3FBEC8D3.3040807@familyhealth.com.au>...
> Lastly, I presume it's possible to create a system of circular 
> dependencies (eg create or replace view), which really cannot be solved 
> without a system of 'shells', similar to that needed to dump types and 
> their i/o functions.
> 
> Views seem to be by far the nastiest object.  They can be dependent on 
> almost everything in the database.

Hello Group,

It might be an idea to keep track of all data-definition changes
during the lifetime of a database. Keep all the
SQL-definition-commands in a seperate systemtable somewhere. Then,
when the schema is dumped you'd have the choice of dumping:
- the most recent schema with database-determined ordering (as is the
case in the current situation)
- "replay" the "recorded" datadefinition of the past, so you know the
data definition is executed in a "sound" sequence.

Of course, data itself would be extracted seperate of the definitions
and there would also be the need to remove constrains while the data
is being loaded. This last thing could be done by parsing the
"recorded" data-definition-commands or by first blindly running the
"recorded" commands, then removing (or disabling) any constraints that
are there and finally replacing (or re-enabling) the constraints.

Negative side of this idea is obviously that you need to make changes
to a lot of internals of the postgresql database. AND you need to make
perfectly sure that the state of the database is always consistent
with the state of the recorded SQL.

Good Luck,
Arian.


pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: ALTER COLUMN/logical column position
Next
From: "Tom Hebbron"
Date:
Subject: Re: Handy user/group hack