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

Re: contrib/dblink GRANTs and regression test fix

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: contrib/dblink GRANTs and regression test fix
Date: 2002-09-14 21:31:30
Message-ID: 3D83AAB2.5070703@joeconway.com (view raw or flat)
Thread:
Lists: pgsql-patches
Tom Lane wrote:
> Applied.  The method for dropping the second database seems pretty
> cheesy itself, though; and wouldn't it make it harder to investigate
> the cause of a test failure, if one occurs?  I think I'd vote for
> getting rid of the trailing wait() and DROP and instead doing
> 
> \set ECHO none
> DROP DATABASE regression_slave;
> \set ECHO all
> CREATE DATABASE regression_slave;

Yeah, I knew wait() was a bit of a kludge itself. But I couldn't get the drop 
at the end to work (due to disconnect time I guess). I tried your suggestion 
above, but "\set ECHO none" doesn't suppress the error message when 
regression_slave does not already exist:

\set ECHO none
ERROR:  DROP DATABASE: database "regression_slave" does not exist

So if expected/dblink.out includes this, it will fail on second and subsequent 
runs of `make installcheck`. I guess it's easy enough to see why, but it 
doesn't seem ideal either.

What do you think about a plpgsql function to check for the existence of 
database "regression_slave", and drop it conditionally -- run at the beginning 
of the script in place of DROP DATABASE?

Joe

p.s. BTW, I think this is a good example why an IF construct supported by the 
main grammer would be nice. Something like:
     IF (expression) {statements};
or something similar would allow conditional dropping of objects if they 
exist, but no ERROR if they didn't. Possible 7.4 TODO?






In response to

Responses

pgsql-patches by date

Next:From: Joe ConwayDate: 2002-09-14 21:48:48
Subject: Re: contrib/dblink GRANTs and regression test fix
Previous:From: Tom LaneDate: 2002-09-14 20:32:14
Subject: Re: one more small dblink fix

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