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?