Re: [HACKERS] dump/reload
От | Jose' Soares Da Silva |
---|---|
Тема | Re: [HACKERS] dump/reload |
Дата | |
Msg-id | Pine.LNX.3.96.980603112522.8286A-100000@proxy.bazzanese.com обсуждение исходный текст |
Ответ на | Re: [HACKERS] dump/reload (Bruce Momjian <maillist@candle.pha.pa.us>) |
Ответы |
Re: [HACKERS] dump/reload
|
Список | pgsql-hackers |
On Tue, 2 Jun 1998, Bruce Momjian wrote: > > > > > > they don't always work, in the case of a table with an attribute that > > calls a function for its default value. > > > > postgres=> create function foo() returns int4 as 'select 1' language 'sql'; > > CREATE > > postgres=> create table a (b int4 default foo()); > > CREATE > > > > % pg_dump postgres > tmpfile > > % cat tmpfile > > \connect - postgres > > CREATE TABLE a (b int4 DEFAULT foo ( )); > > \connect - postgres > > CREATE FUNCTION foo ( ) RETURNS int4 AS 'select 1' LANGUAGE 'SQL'; > > COPY a FROM stdin; > > \. > > % destroydb > > % createdb > > % psql < tmpfile > > > > which of course doesn't work, because it tries to create the table before > > the function, which fails. > > > > then it spits out the help message because it can't understand \. > > > > this happens every time I dump/reload my db > > > > not a super easy fix, because sql functions can depend on tables to be > > created as well as table depending on functions. are circular > > references possible? doesn't seem like they would be. > > > > so pg_dump would have to figure out what order to put the > > table/function creation in. perhaps having ppl manually re-ordering > > the dump output (and documenting this accordingly!) is the best way. > > > > > > This is a good point, and something worth thinking about. Maybe we > could scan through the defaults for a table, and call the dumpfunction > command for any functions. Then when they are later attempted to be > created, they would fail, or we could somehow mark them as already > dumped. > Apologies for intrusion, I have also a problem with pg_dump, I already posted a bug-report but nobody replays. If you already know this problem, forget this message. postgres=> create table prova (var varchar, bp bpchar check (bp='zero')); CREATE postgres=> create view wprova as select var from prova; CREATE $ pg_dump hygea -s prova > file $ cat file \connect - postgres CREATE TABLE prova (var varchar(-5), bp char(-5)) CONSTRAINT prova_bp CHECK bp = 'zero'; COPY prova FROM stdin; \. --------------- . pg_dump don't recreate VIEWs . recreates varchar as varchar(-5) . recreates bpchar as CHAR(-5) . recreates CONSTRAINTs with wrong syntax Jose'
В списке pgsql-hackers по дате отправления: