X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4700F476141; Thu, 8 May 2003 17:45:19 -0400 (EDT) Received: from djinn.gene.com (djinn-open.gene.COM [192.12.78.2]) by postgresql.org (Postfix) with ESMTP id 5F96D474E4F; Thu, 8 May 2003 17:45:18 -0400 (EDT) Received: from tallac.gene.com (tallac.gene.com [128.137.116.213]) by djinn.gene.com (8.12.9/8.12.4) with ESMTP id h48LjK3Z010460; Thu, 8 May 2003 14:45:20 -0700 (PDT) Received: by tallac.gene.com (Postfix, from userid 13922) id A3DAD4B854; Thu, 8 May 2003 17:45:19 -0400 (EDT) Subject: pg_dump session authorization fails during restore From: Reece Hart Reply-To: reece@in-machina.com To: pgsql-admin@postgresql.org, pgsql-bugs@postgresql.org Content-Type: multipart/mixed; boundary="=-mrjYSHPREfOblV2FxmjD" Organization: Message-Id: <1052430319.7794.74.camel@tallac> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 08 May 2003 14:45:19 -0700 X-Spam-Status: No, hits=-12.1 required=5.0 tests=BAYES_10,USER_AGENT_XIMIAN autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/107 X-Sequence-Number: 8669 --=-mrjYSHPREfOblV2FxmjD Content-Type: text/plain Content-Transfer-Encoding: 7bit I'm having a problem restoring from a backup that may indicate a small problem with pg_dump. I've included sample output below and a test script. I'd appreciate confirmation that I'm reading the issue correctly as well as any news of a fix. SYSTEM: postgresql 7.3.2, linux 2.4 PROBLEM: pg_dump emits SET SESSION AUTHORIZATION before a user-owned schema is created. During restore, the CREATE SCHEMA fails (presuming the owning user doesn't have schema creation privileges). All subsequent restoration to that schema fails as well, of course. EXAMPLE OUTPUT DURING RESTORE (you can recreate this with the script below and attached) $ PGUSER=admin PGPASSWORD=xxx USER=rkh ./pgdtest [...] SET SESSION AUTHORIZATION 'rkh'; -- -- TOC entry 2 (OID 28785657) -- Name: rkh; Type: SCHEMA; Schema: -; Owner: rkh -- CREATE SCHEMA rkh; psql::12: ERROR: t2: permission denied SET search_path = rkh, pg_catalog; psql::15: ERROR: Namespace "rkh" does not exist -- -- TOC entry 3 (OID 28785658) [...] PROPOSED SOLUTION: How about creating all schemas up-front? -Reece You can generate the above with the following script (same as attached): #!/bin/sh -ex # pgdtest -- script to demonstrate session auth problem when restoring # non-admin schemas and tables from pg_dump-generated sql # INVOKE LIKE THIS: # $ PGUSER= PGPASSWORD= USER= ./pgdtest # and perhaps with PGHOST # USER is the non-administrative login to use for testing # /tmp/t1.pgdump will be created and contains the pgdump output # Reece Hart # t1 will be the source db and we'll restore into t2 createdb t1; createdb t2; # create a user-owned schema and table in t1 psql -qa -dt1 -f- < PGPASSWORD=3D USER=3D ./pgdtest # and perhaps with PGHOST # USER is the non-administrative login to use for testing # /tmp/t1.pgdump will be created and contains the pgdump output # Reece Hart # t1 will be the source db and we'll restore into t2 createdb t1; createdb t2; # create a user-owned schema and table in t1 psql -qa -dt1 -f- <