Re: CREATE ROLE IF NOT EXISTS

Поиск
Список
Период
Сортировка
От Mark Dilger
Тема Re: CREATE ROLE IF NOT EXISTS
Дата
Msg-id F57B443F-68E0-414E-BDC1-5A37D03A7F99@enterprisedb.com
обсуждение исходный текст
Ответ на Re: CREATE ROLE IF NOT EXISTS  (David Christensen <david.christensen@crunchydata.com>)
Ответы Re: CREATE ROLE IF NOT EXISTS  (Stephen Frost <sfrost@snowman.net>)
Re: CREATE ROLE IF NOT EXISTS  (David Christensen <david.christensen@crunchydata.com>)
Список pgsql-hackers

> On Nov 9, 2021, at 7:36 AM, David Christensen <david.christensen@crunchydata.com> wrote:
>
> If CINE semantics are at issue, what about the CREATE OR REPLACE semantics with some sort of merge into the existing
role? I don't care strongly about which approach is taken, just think the overall "make this role exist in this form"
withoutan error is useful in my own work, and CINE was easier to implement as a first pass. 

CREATE OR REPLACE might be a better option, not with the "merge into the existing role" part, but rather as
drop+create. If a malicious actor has already added other roles to the role, or created a table with a malicious
triggerdefinition, the drop part will fail, which is good from a security viewpoint.  Of course, the drop portion will
alsofail under other conditions which don't entail any security concerns, but maybe they could be addressed in a series
offollow-on patches? 

I understand this idea is not as useful for creating idempotent scripts, but maybe it gets you part of the way there?

—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company






В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: [RFC] building postgres with meson -v
Следующее
От: vignesh C
Дата:
Сообщение: Re: Identify missing publications from publisher while create/alter subscription.