Sue Fitt <sue@inf.ed.ac.uk> writes:
> (I tried v7.4 and v8.0.4 pg_dump and got the same thing). Looking at the
> output file db.out I can see that the domain and function are used near
> the beginning of the file, but defined at the end.
I don't think you tried the 8.0 pg_dump. (7.4 did not have any
dependency ordering logic and so was quite prone to this sort of thing,
but 8.0 ought to get it right.) If you're certain you did use 8.0,
could we see those parts of the schema?
> As an aside, why does pg_dump output altered tables as CREATE TABLE...
> ALTER TABLE instead of just updating the CREATE TABLE statement to
> assimilate the ALTER TABLE information?
This is one of the techniques used to break circular dependencies.
Also, indexes and foreign key constraints are deliberately added after
loading data, for speed reasons.
regards, tom lane