Re: Need help extripating plpgsql - Mailing list pgsql-general

From Kevin Grittner
Subject Re: Need help extripating plpgsql
Date
Msg-id 1361571926.14740.YahooMailNeo@web162905.mail.bf1.yahoo.com
Whole thread Raw
In response to Re: Need help extripating plpgsql  (Adrian Klaver <adrian.klaver@gmail.com>)
Responses Re: Need help extripating plpgsql  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-general
Adrian Klaver <adrian.klaver@gmail.com> wrote:=0A> On 02/22/2013 11:59 AM, =
Kevin Grittner wrote:=0A>> Adrian Klaver <adrian.klaver@gmail.com> wrote:=
=0A>>=0A>>> At this point I am not sure how to do this with out creating ro=
le=0A>>> that has superuser privileges.=0A>>=0A>> Something like this?:=0A>=
>=0A>> -- Set up the template using database superuser.=0A>> create databas=
e template2;=0A>> \c template2=0A>> drop extension plpgsql;=0A>> vacuum fre=
eze analyze;=0A>> \c postgres=0A>> update pg_database set datistemplate =3D=
 true=0A>>=A0=A0=A0=A0 where datname =3D 'template2';=0A>> checkpoint;=0A>>=
=0A>> -- Create a user who can own the database and plpgsql.=0A>> create us=
er bob with createdb;=0A>> set role bob;=0A>> create database bob template =
template2;=0A>> \c bob=0A>> create extension plpgsql;=0A>=0A> If you do as =
above plpgsql is created as with owner postgres.=0A>=0A> To get owner to be=
 bob you need to do:=0A>=0A> \c bob=0A> set role bob;=0A> create extension =
plpgsql;=0A=0AGood point, I forgot that the user was reset by \c.=0A=0A> Ei=
ther way you still get the error on the COMMENT which is what is=0A> trippi=
ng up the OP.=0A=0AThe good news is that it seems to be fixed on HEAD:=0A=
=0Atest=3D# drop database bob;=0ADROP DATABASE=0Atest=3D# set role bob;=0AS=
ET=0Atest=3D> create database bob template template2;=0ACREATE DATABASE=0At=
est=3D> \c bob bob=0AYou are now connected to database "bob" as user "bob".=
=0Abob=3D> create extension plpgsql;=0ACREATE EXTENSION=0Abob=3D> \dL=0A=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 List of languages=0A=
=A0 Name=A0=A0 | Owner | Trusted |=A0=A0=A0=A0=A0=A0=A0=A0 Description=A0=
=A0=A0=A0=A0=A0=A0 =A0=0A---------+-------+---------+----------------------=
--------=0A=A0plpgsql | bob=A0=A0 | t=A0=A0=A0=A0=A0=A0 | PL/pgSQL procedur=
al language=0A(1 row)=0A=0A--=0A=0AKevin Grittner=0AEnterpriseDB: http://ww=
w.enterprisedb.com=0AThe Enterprise PostgreSQL Company

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Need help extripating plpgsql
Next
From: Adrian Klaver
Date:
Subject: Re: Need help extripating plpgsql