Re: fixing CREATEROLE - Mailing list pgsql-hackers

From walther@technowledgy.de
Subject Re: fixing CREATEROLE
Date
Msg-id fda52bc3-c2e8-39c2-f4d9-efcececc596c@technowledgy.de
Whole thread Raw
In response to Re: fixing CREATEROLE  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: fixing CREATEROLE
List pgsql-hackers
Robert Haas:
> 2. There are some serious implementation challenges because the
> constraints on duplicate object names must be something which can be
> enforced by unique constraints on the relevant catalogs. Off-hand, I
> don't see how to do that. It would be easy to make the cluster roles
> all have unique names, and it would be easy to make the database roles
> have unique names within each database, but I have no idea how you
> would keep a database role from having the same name as a cluster
> role. For anyone to try to implement this, we'd need to have a
> solution to that problem.

For each database created, create a partial unique index:

CREATE UNIQUE INDEX ... ON pg_authid (rolname) WHERE roldatabase IN (0, 
<database_oid>);

Is that possible on catalogs?

Best,

Wolfgang



pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: Add 64-bit XIDs into PostgreSQL 15
Next
From: Tom Lane
Date:
Subject: Re: fixing CREATEROLE