Re: [ADMIN] problems with pg_restore - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [ADMIN] problems with pg_restore
Date
Msg-id 8299.1058299393@sss.pgh.pa.us
Whole thread Raw
In response to Re: [ADMIN] problems with pg_restore  (Rod Taylor <rbt@rbt.ca>)
Responses Re: [ADMIN] problems with pg_restore  (Rod Taylor <rbt@rbt.ca>)
Re: [ADMIN] problems with pg_restore  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List pgsql-hackers
Rod Taylor <rbt@rbt.ca> writes:
>> Hackers: this seems like an extremely bad side-effect of what we thought
>> was a simple addition of a helpful check.  I am thinking we should
>> either remove the check again, or downgrade it to a WARNING (though I'm
>> not quite sure how to phrase the warning ...).  Any thoughts?

> How about going the other way and removing the requirement to explicitly
> state the database?
> COMMENT ON DATABASE IS 'This comment is on the current database.';

Won't help us for reading existing pg_dump scripts, although perhaps it
would be useful going forward.

Given the current implementation, it seems like there are three possible
behaviors for COMMENT ON DATABASE when the database name isn't the same
as the current database:

1. Raise error (what we're doing now).  Simple but breaks dump scripts
   for the restore-into-different-DB scenario.

2. Do nothing, store the comment in the current DB's pg_description
   (what we did in 7.2).  Now that I think about it, this also fails
   for different-database restore, since very possibly the attempt
   to look up the DB name will fail --- you'll get a no-such-database
   error instead of the present error, but it's still unhelpful.

3. Ignore the specified DB name, store the comment as the description
   of the current DB; possibly give a warning saying we're doing so.
   This would allow correct restoration of dumps into different DBs,
   but I think people would find it awfully surprising :-(

            regards, tom lane

pgsql-hackers by date:

Previous
From: Rod Taylor
Date:
Subject: Re: [ADMIN] problems with pg_restore
Next
From: ivan
Date:
Subject: perm question