X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9B5B8D1B504 for ; Mon, 10 Nov 2003 19:06:43 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 60328-10 for ; Mon, 10 Nov 2003 15:06:13 -0400 (AST) Received: from smtp.noos.fr (nan-smtp-19.noos.net [212.198.2.119]) by svr1.postgresql.org (Postfix) with ESMTP id D1A82D1B523 for ; Mon, 10 Nov 2003 15:06:10 -0400 (AST) Received: (qmail 25035 invoked by uid 0); 10 Nov 2003 19:05:59 -0000 Received: from unknown (HELO bigfoot.com) ([212.198.40.101]) (envelope-sender ) by 212.198.2.119 (qmail-ldap-1.03) with SMTP for ; 10 Nov 2003 19:05:59 -0000 Message-ID: <3FAFE187.90605@bigfoot.com> Date: Mon, 10 Nov 2003 20:05:43 +0100 From: Gaetano Mendola User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031013 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "pgsql-admin@postgresql.org" Cc: Tom Lane Subject: Re: pg_shadow dump annoying problem References: <3FAED792.5010508@bigfoot.com> <10747.1068427973@sss.pgh.pa.us> In-Reply-To: <10747.1068427973@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/167 X-Sequence-Number: 11154 Tom Lane wrote: > Gaetano Mendola writes: > >>[ pg_dumpall emits this: ] >>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. > > > How so? If that deletes all users then you have already removed the > user who owns template0, ie, the user who did initdb. That is a really > bad idea. I didn't say this, I just wrote that if the file generated is used by a user different the postgres will result in a disaster, and may be is better not delete all the user except the user that own template0 but not delete the user that own template0 and the current_user. Regards Gaetano Mendola