Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements
Дата
Msg-id 20140401043434.GP4582@tamriel.snowman.net
обсуждение исходный текст
Ответ на Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements  (Michael Paquier <michael.paquier@gmail.com>)
Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
* Michael Paquier (michael.paquier@gmail.com) wrote:
> On Tue, Apr 1, 2014 at 7:28 AM, Fabrízio de Royes Mello
> <fabriziomello@gmail.com> wrote:
> > Think about the statements below:
> >
> > CREATE ROLE test NOLOGIN;
> > CREATE OR REPLACE ROLE test;
> >
> > If we execute the statements above the result should be the role 'test' can
> > login. Correct?

> Except if I am missing something, the second query means that it is
> going to replace the existing user test with a new one, with the
> settings specified in the 2nd query, all being default values. As the
> default for login is NOLOGIN, the user test should not be able to log
> in the server.

That's more-or-less the behavior we're trying to work out.  I've been
meaning to go back and look at what we've been doing with the existing
COR cases and just haven't gotten to it yet.  The pertinent question
being if we assume the user intended for the values not specified to be
reset to their defaults, or not.

Where this is a bit more interesting is in the case of sequences, where
resetting the sequence to zero may cause further inserts into an
existing table to fail.  Of course, were a user to use 'drop if exists'
followed by a 'create', they'd get the same behavior..  However, 'create
if not exists' would leave the sequence alone, but in a potentially
unknown state.
Thanks,
    Stephen

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements
Следующее
От: Fabrízio de Royes Mello
Дата:
Сообщение: Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements