| От | Tom Lane |
|---|---|
| Тема | Re: pg_dump and DEFAULT column values |
| Дата | |
| Msg-id | 21436.1005082579@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | pg_dump and DEFAULT column values ("Eric Ridge" <ebr@tcdi.com>) |
| Список | pgsql-general |
"Eric Ridge" <ebr@tcdi.com> writes:
> I have a function and a table:
> create table foo (
> f1 integer default foo_func();
> );
> create function foo_func returns integer
> as 'select max(f1)+1 from foo'
> language 'sql';
> when I use pg_dump, and then psql (\i <dumpfile>) to dump/reload
> everything, table foo can't be created because it uses foo_func which
> can't be created because it uses a table (foo) which doesn't exist.
pg_dump has a hard time with circular dependencies :-(
Have you considered using a sequence, rather than generating new values
as shown above? The approach you are using is extremely fragile:
consider what happens if two backends try to insert at the same time.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера