How non-superuser can restore database containing procedures

Started by Andrusover 19 years ago3 messagesgeneral
Jump to latest
#1Andrus
kobruleht2@hot.ee

I need to allow non-superusers to create and restore databases containing
plpgsql language procedures.
template0 and template1 do not have any languages installed.

During restore they receive error:

pg_restore: [archiver (db)] could not execute query: ERROR: must be
superuser to create procedural language
Command was: CREATE PROCEDURAL LANGUAGE plpgsql;

How to allow non-superusres to create database with language ?

Andrus.

#2Richard Huxton
dev@archonet.com
In reply to: Andrus (#1)
Re: How non-superuser can restore database containing procedures

Andrus wrote:

How to allow non-superusres to create database with language ?

You can't. If they can install a language-handler, they can install code
that can do anything, including take control of the server and the unix
account it runs as.

--
Richard Huxton
Archonet Ltd

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Richard Huxton (#2)
Re: How non-superuser can restore database containing procedures

Richard Huxton <dev@archonet.com> writes:

Andrus wrote:

How to allow non-superusres to create database with language ?

You can't. If they can install a language-handler, they can install code
that can do anything, including take control of the server and the unix
account it runs as.

However, you could install the desired languages into template1, or
perhaps better make an extra template database containing them.
Then CREATE DATABASE could copy them into new databases.

regards, tom lane