Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] dump/reload

From: "Jose' Soares Da Silva" <sferac(at)bo(dot)nettuno(dot)it>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: Brett McCormick <brett(at)work(dot)chicken(dot)org>, pgsql-hackers(at)hub(dot)org
Subject: Re: [HACKERS] dump/reload
Date: 1998-06-03 11:33:28
Message-ID: Pine.LNX.3.96.980603112522.8286A-100000@proxy.bazzanese.com (view raw or flat)
Thread:
Lists: 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'


In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 1998-06-03 12:43:18
Subject: Re: [HACKERS] keeping track of connections
Previous:From: Jose' Soares Da SilvaDate: 1998-06-03 11:02:06
Subject: Re: [HACKERS] Re: [INTERFACES] ODBC is slow with M$-Access Report

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group