Re: Inheritance problem when restoring db

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Inheritance problem when restoring db
Дата
Msg-id 29166.1193586417@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Inheritance problem when restoring db  ("Sebastjan Trepca" <trepca@gmail.com>)
Ответы Re: Inheritance problem when restoring db  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
"Sebastjan Trepca" <trepca@gmail.com> writes:
> This is how to reproduce this issue:
> ...
> inh_test=# alter table capitals inherit cities;

Fascinating.  pg_dump is almost smart enough to get this right, except
that what it spits out is

ALTER TABLE capitals ALTER COLUMN id SET DEFAULT nextval('capitals_id_seq'::regclass);
...
ALTER TABLE cities ALTER COLUMN id SET DEFAULT nextval('cities_id_seq'::regclass);

and since it already declared capitals as inheriting from cities, the
second command descends the inheritance tree and replaces the local
default for capitals.

What we apparently must do is add a dependency relation within pg_dump
to cause these two commands to be emitted in the other order.  I briefly
considered making these sorts of ALTERs be ALTER TABLE ONLY, but if we
go that route we will be unable to correctly restore the inherited vs
not-inherited property of default expressions.  (Not that the system
tracks that currently, but I think there were proposals on the table
to do so.)

            regards, tom lane

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

Предыдущее
От: Perry Smith
Дата:
Сообщение: Re: I want to search my project source code
Следующее
От: aklaver@comcast.net (Adrian Klaver)
Дата:
Сообщение: Re: select count() out of memory