Обсуждение: How non-superuser can restore database containing procedures

Поиск
Список
Период
Сортировка

How non-superuser can restore database containing procedures

От
"Andrus"
Дата:
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.



Re: How non-superuser can restore database containing procedures

От
Richard Huxton
Дата:
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

Re: How non-superuser can restore database containing procedures

От
Tom Lane
Дата:
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