Re: pg_dump: Sorted output, referential integrity

From: Christof Petig <christof(at)petig-baender(dot)de>
To: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_dump: Sorted output, referential integrity
Date: 2001-12-07 14:16:26
Message-ID: 3C10CF3A.BE83A55@petig-baender.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Philip Warner wrote:

Ah, yes. Now I remember it was you improving pg_dump.

> At 12:05 6/12/01 +0100, Christof Petig wrote:
> >
> >- pg_dump outputs the data unsorted
>
> Not quite correct; it outputs them in an order that is designed to improve
> the chances of dependencies being satisfied, and improve the performance of
> a full restore (a modified OID order).

That's perfect - unless you want to diff two pg_dumps

> > but to manage the data in a version
> >control system you need it consistently sorted. So a flag to sort by
> >either primary key or left to right would be of great value. (--sorted
> >?)
>
> Not really very generalizable when you consider user defined types,
> triggers etc.

Hmmm. But if we have a primary key on columns (A,B,C) and request the data
'order by A,B,C' this should be portable, shouldn't it?
If we don't have a primary key simply ordering by 1,2,3,...n should also work.
Or am I missing something?

> >- pg_dump outputs referential constraints as 3 triggers (near to two
> >different tables) per constraint. A mode which outputs the original
> >statement (alter table ... add constraint) would be more sql standard
>
> Abosolutely; with time we are moving pg_dump to use standard SQL.

Great news.

> >So, I'm kindly asking for your opinion regarding this two features.
> >Does anybody plan to implement them?
>
> No plans for the first one, but sorting by ('object-type', 'object-name')
> would be close to trivial, if there is much interest/support for it.

I don't understand what you mean by 'sorting by object-type/name', can you
give me an example. Simply adding an (optional) order by clause was the one I
intended.

> The second (SQL conformance) is high on my list; a few people (Chris &
> Stephen?) have been working hard to implement 'alter table add/etc
> constraint'. When this is stable, we will move pg_dump in that direction.
> But as of 7.1, there were still wrinkles in the the implementation that
> meant it was unsuitable for pg_dump. Not sure about the status in 7.2.

Oh, I was targeting 7.2. I can not surely tell about 7.2, but have seen cvs
logs implementing similar things.

Christof

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-12-07 14:20:41 Re: text -> time cast problem
Previous Message mlw 2001-12-07 14:04:57 Re: restoring a shadow