Allow an user (not superuser) to create a testing database from a production database

From: Jorge Silva <jorge(dot)silva93(at)gmail(dot)com>
To: "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Allow an user (not superuser) to create a testing database from a production database
Date: 2023-06-07 21:19:01
Message-ID: CP6P284MB1930AE5210C0F7C566CEC980FE53A@CP6P284MB1930.BRAP284.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi everyone,

We have a database which recurrently we create a testing database making a copy of it. Under the superuser “postgres” we use the command “CREATE DATABASE totvs_test WITH TEMPLATE totvs_production;” which works pretty well.

But now I would like to allow an user, which is not the owner of the totvs_production database, and neither is a superuser, to execute this same command.

In order to achieve this, it seems that I have to give him the access “CREATEDB” and make our production database a template database. Do you know if there any safety, performance or any other kind of issue in making our production database as a template in postgres and keep using it for production tasks? This user, who would make this copy, already has access to SELECT in all the data of this database, but they have no rights in DELETE, UPDATE or INSERT.

Thanks in advance.

Jorge Luiz Moreira Silva
Diretor Industrial
Polimet Indústria Metalúrgica
+55 (15) 3363-8633

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Erik Wienhold 2023-06-08 13:25:55 Re: Allow an user (not superuser) to create a testing database from a production database
Previous Message David G. Johnston 2023-06-05 20:43:01 Re: SSL enabled connection for PostgreSQL