X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 300BD476463; Thu, 8 May 2003 17:25:46 -0400 (EDT) Received: from efreet.gene.com (efreet-open.gene.com [192.12.78.77]) by postgresql.org (Postfix) with ESMTP id F2672476410; Thu, 8 May 2003 17:25:44 -0400 (EDT) Received: from zappa.gene.com (zappa.gene.com [128.137.1.70]) by efreet.gene.com (8.12.9/8.12.4) with ESMTP id h48LPkbN090148; Thu, 8 May 2003 14:25:46 -0700 (PDT) Received: from tallac.gene.com (tallac.gene.com [128.137.116.213]) by zappa.gene.com (8.11.0/8.11.0) with ESMTP id h48LOWm2514873; Thu, 8 May 2003 14:24:32 -0700 (PDT) Subject: pg_dump session authorization fails during restore From: Reece Hart To: pgsql-admin@postgresql.org, pgsql-bugs@postgresql.org Content-Type: multipart/mixed; boundary="=-4UT98BDwf3ob+lRwu6jW" Organization: Message-Id: <1052429071.7794.52.camel@tallac> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 08 May 2003 14:24:32 -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/168 X-Sequence-Number: 8730 --=-4UT98BDwf3ob+lRwu6jW 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 appreciation 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) [...] 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= 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- <