Re: CREATE ROLE IF NOT EXISTS - Mailing list pgsql-hackers

From David Christensen
Subject Re: CREATE ROLE IF NOT EXISTS
Date
Msg-id CAOxo6X+HM=XBtWCsNV6zbUCCCWtwyQMREERJ7rFRu3-4NMbYGw@mail.gmail.com
Whole thread Raw
In response to Re: CREATE ROLE IF NOT EXISTS  (Mark Dilger <mark.dilger@enterprisedb.com>)
Responses Re: CREATE ROLE IF NOT EXISTS
List pgsql-hackers
Modulo other issues/discussions, here is a version of this patch that implements CREATE OR REPLACE ROLE just by handing off to AlterRole if it's determined that the role already exists; presumably any/all additional considerations would need to be added in both places were there a separate code path for this.

It might be worth refactoring the AlterRole into a helper if there are any deviations in messages, etc, but could be a decent approach to handling the problem (which arguably would have similar restrictions/requirements in ALTER ROLE itself) in a single location.

Best,

David
Attachment

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: On login trigger: take three
Next
From: "Bossart, Nathan"
Date:
Subject: Re: partial heap only tuples