Re: 9.0: plpgsql eror when restoring a database as a non superuser

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: stefan <stefan(at)therp(dot)nl>
Subject: Re: 9.0: plpgsql eror when restoring a database as a non superuser
Date: 2011-10-22 20:09:22
Message-ID: 201110221309.22674.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2011-10-22 20:31:32 copying few fields into an existing table
Previous Message stefan 2011-10-22 19:09:59 Re: 9.0: plpgsql eror when restoring a database as a non superuser