Re: Restrict user to create only one db with a specific name

2020-03-08 Thread Peter J. Holzer
On 2020-03-06 16:39:14 -0700, David G. Johnston wrote: > On Fri, Mar 6, 2020 at 4:28 PM Tiffany Thang wrote: > Is there a way in PostgreSQL 12 to restrict user to creating a database > with a specific database name? [...] > Why does userA need create database privileges? Not speaking for

Re: Restrict user to create only one db with a specific name

2020-03-08 Thread Paul Förster
Hi Tiff, note that there is an absurd high maximum of databases possible inside a PostgreSQL database cluster. I think, the maximum is 4,294,950,911 but I'm sure you don't get that many users or databases anyway. ;-) Cheers, Paul > On 07. Mar, 2020, at 23:35, Tiffany Thang wrote: > > Thanks

Re: Restrict user to create only one db with a specific name

2020-03-07 Thread Tiffany Thang
Thanks David and Paul. Because each user wants the ability to drop and recreate their own databases, I want to impose a restriction on the database names. I’ll just implement what Paul has suggested. Thanks. Tiff On Sat, Mar 7, 2020 at 2:35 AM Paul Förster wrote: > Hi Tiff, > > from what you s

Re: Restrict user to create only one db with a specific name

2020-03-06 Thread Paul Förster
Hi Tiff, from what you say, it sounds that each user should have his or her own database. Considering the other answers here already pointing out the difficulties, why don't you just create a database for each user with the same name as the username and grant him or her access to it. So, basic

Re: Restrict user to create only one db with a specific name

2020-03-06 Thread David G. Johnston
On Friday, March 6, 2020, David G. Johnston wrote: > On Fri, Mar 6, 2020 at 4:28 PM Tiffany Thang > wrote: > >> Hi, >> Is there a way in PostgreSQL 12 to restrict user to creating a database >> with a specific database name? >> >> > >> You could just have them log into an admin database and run

Re: Restrict user to create only one db with a specific name

2020-03-06 Thread David G. Johnston
On Fri, Mar 6, 2020 at 4:28 PM Tiffany Thang wrote: > Hi, > Is there a way in PostgreSQL 12 to restrict user to creating a database > with a specific database name? > > For example, userA can only create a database with a name called mydb. Any > other names would generate an error. > > If that is

Restrict user to create only one db with a specific name

2020-03-06 Thread Tiffany Thang
Hi, Is there a way in PostgreSQL 12 to restrict user to creating a database with a specific database name? For example, userA can only create a database with a name called mydb. Any other names would generate an error. If that is not possible, will it be possible then to limit userA to creating o