pg_dump + function/table hierarchy

Поиск
Список
Период
Сортировка
От Kovacs Zoltan Sandor
Тема pg_dump + function/table hierarchy
Дата
Msg-id Pine.LNX.4.05.10007292116340.11253-100000@pc10.radnoti-szeged.sulinet.hu
обсуждение исходный текст
Список pgsql-hackers
Unfortunately I managed to create a problematic database. The problem
occurs if I execute pg_dump and then try to reload the database. Details:

My only definitions in this database are:

> create function x(int4) returns bool as 'select $1 > 10;' language 'sql';
> create table y(z int4 check(x(z)));

Then, after pg_dump I got the next dump:

\connect - postgres
CREATE TABLE "y" ("z" int4,CONSTRAINT "y_z" CHECK (x(z))
);
CREATE FUNCTION "x" (int4 ) RETURNS bool AS 'select $1 > 10;' LANGUAGE 'SQL';
COPY "y" FROM stdin;
\.

Then, loading this dump back into the dropped and recreated database, I
got error messages, because the FUNCTION "x" is not created before the
TABLE "y".

The problem doesn't seems to be solved too easily. In fact, it is not a
good solution that FUNCTIONs are dumped before the TABLEs, because
the 'SQL' FUNCTIONs use the TABLEs in general (and the parser tries to
detect the SQL query). What to do? We need to store some kind of hierarchy
between table and function definitions, and after that could we say
something about the regenerating order. Of course, it needs at least one
new table among the system tables and needs pg_dump to be a bit more
complicated.

Regards,
Zoltan

------------------------------------------------------------------------------
KOVACS, Zoltan                              tip@pc10.radnoti-szeged.sulinet.hu



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Anyone care about type "filename" ?
Следующее
От: Tom Lane
Дата:
Сообщение: Hmm, should ACL[] be toastable?