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'
    LANGUAGE c;

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


---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Reply via email to