Re: 9.0: plpgsql eror when restoring a database as a non superuser - Mailing list pgsql-general

From Adrian Klaver
Subject Re: 9.0: plpgsql eror when restoring a database as a non superuser
Date
Msg-id 201110221309.22674.adrian.klaver@gmail.com
Whole thread Raw
In response to Re: 9.0: plpgsql eror when restoring a database as a non superuser  (stefan <stefan@therp.nl>)
List pgsql-general
On Saturday, October 22, 2011 12:06:25 pm stefan wrote:
> >> Therefore the only solution I see is to drop plpgsql from template1, or
> >> writing a wrapper script that exploits the -l and -L options of
> >> pg_restore.
> >
> > Yes. Though I could see an option to create a template database without
> > plpgsql in it for use by non-superuser users and leave template1 as is.
>
> Adrian,
>
> Thanks for suggesting that. I had not thought about that option and it
> may just be the best.

Actually I was going to suggest something more. In the new template CREATE a
non-superuser ROLE and then as super user change ownership of the plpgsql to
that ROLE for that template and databases derived from it. That actually works
until you do the dump when it reverts ownership back to the postgres user. Not
quite sure why that is? At any rate a dead end.

>
> Cheers,
> Stefan.

--
Adrian Klaver
adrian.klaver@gmail.com

pgsql-general by date:

Previous
From: stefan
Date:
Subject: Re: 9.0: plpgsql eror when restoring a database as a non superuser
Next
From: Alexander Farber
Date:
Subject: copying few fields into an existing table