Dump problems with superusers - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Dump problems with superusers
Date
Msg-id 40B2C23F.7050509@familyhealth.com.au
Whole thread Raw
List pgsql-hackers
Hi,

There are several objects in PostgreSQL that you can only create if you 
are a superuser, eg. procedural languages.

If you do this, you break the dump:

1. create a superuser
2. install a language as that superuser
3. drop the superuser privs from that superuser
4. dump the database
5. attempt to restore the database

It fails because this is what gets dumped:

CREATE USER test WITH SYSID 100 NOCREATEDB NOCREATEUSER;
...
SET SESSION AUTHORIZATION 'test';

CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler    AS '$libdir/plpgsql', 'plpgsql_call_handler'
LANGUAGEc;
 

CREATE FUNCTION plpgsql_validator(oid) RETURNS void    AS '$libdir/plpgsql', 'plpgsql_validator'    LANGUAGE c;

SET SESSION AUTHORIZATION DEFAULT;

CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler 
VALIDATOR plpgsql_validator;

Now it cannot restore the dump as the 'test' user no longer has 
permissions to do so.

Chris



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Timezone fun (bugs and a request)
Next
From: Bruce Momjian
Date:
Subject: Re: New horology failure