On 05/09/2006 03:47:20 PM, Tom Lane wrote:
"Karl O. Pinc" <kop@xxxxxxxx> writes: > I'm wondering if there's a problem with pg_dump --create, > or if I'm just missing something. > It does not seem to restore things like: > ALTER DATABASE foo SET "DateStyle" TO European; > Shouldn't the database that is re-created be like > the database that is being dumped? I don't see any particular problem with leaving it to pg_dumpall, in any case. pg_dump is already assuming that you've correctly set up cluster-wide state; for example it doesn't create users for you.
Thing is, I don't see the ALTER DATABASE x SET ... to be part of a cluster-wide structure, I see it as belonging to a database. (I do see your point as far as database owners go.) The convenient way to backup and restore a single database is to use pg_dump. I could do a pg_dumpall --schema-only and then remove everything not having to do with the specific db I'm interested in when I want to, say, copy a database from one machine to another, but it's a hassle. The SETs make a big difference. I was looking in the wrong schema because I didn't restore my database's my search_path properly. Karl <kop@xxxxxxxx> Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein