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 5EBE9D1B4EF for ; Mon, 10 Nov 2003 01:33:24 +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 95064-07 for ; Sun, 9 Nov 2003 21:32:56 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 552B7D1B4FE for ; Sun, 9 Nov 2003 21:32:52 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id hAA1Wr19010748; Sun, 9 Nov 2003 20:32:53 -0500 (EST) To: Gaetano Mendola Cc: "pgsql-admin@postgresql.org" Subject: Re: pg_shadow dump annoying problem In-reply-to: <3FAED792.5010508@bigfoot.com> References: <3FAED792.5010508@bigfoot.com> Comments: In-reply-to Gaetano Mendola message dated "Mon, 10 Nov 2003 01:10:58 +0100" Date: Sun, 09 Nov 2003 20:32:53 -0500 Message-ID: <10747.1068427973@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/157 X-Sequence-Number: 11144 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. regards, tom lane