From: Gaetano Mendola <mendola@bigfoot.com>
To: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: pg_shadow dump annoying problem
Date: Mon, 10 Nov 2003 01:10:58 +0100
Message-ID: <3FAED792.5010508@bigfoot.com> (raw)
Hi all,
doing a postgres dump I a couple of time in an
annoying problem:
# pg_dumpall -g > pg_user.sql
# head -n 12 pg_user.sql
--
-- PostgreSQL database cluster dump
--
\connect "template1"
--
-- Users
--
DELETE FROM pg_shadow WHERE usesysid <> (SELECT datdba FROM pg_database
WHERE datname = 'template0');
Now if the file pg_user.sql is used accidentally by a user that is not
postgres the result is that all users are deleted ( also the user that
is doing the restore ) and no other user is created.
May be the "DELETE" phase shall be:
DELETE FROM pg_shadow WHERE usesysid <> (SELECT datdba FROM pg_database
WHERE datname = 'template0') AND usename <> current_user;
am I miss something ?
Regards
Gaetano Mendola
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: mendola@bigfoot.com
Subject: Re: pg_shadow dump annoying problem
In-Reply-To: <3FAED792.5010508@bigfoot.com>
References: <3FAED792.5010508@bigfoot.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox