Re: Is this a buggy behavior?

Поиск
Список
Период
Сортировка
От Christophe Pettus
Тема Re: Is this a buggy behavior?
Дата
Msg-id 879037EC-39F7-49E8-A6D7-0FFD3EC2BA0A@thebuild.com
обсуждение исходный текст
Ответ на Re: Is this a buggy behavior?  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: Is this a buggy behavior?
Список pgsql-general
On 3/24/24 08:28, Thiemo Kellner wrote:
> Sure, my example has lots more side effect than silently do the right thing.

I think the point is that it's not really doing anything "silently."  You are asking for a PRIMARY KEY constraint on a
column,and it's giving it to you.  One of the effects (not even really a side-effect) of that request is that the
columnis then declared NOT NULL. 

The reason it doesn't give you a warning is that by the time it would be in a position to, it's forgotten that you
explicitlysaid NULL.  It does see that the column in nullable, but that in itself isn't worth emitting a warning over,
sinceyou are explicitly telling it that now the column shouldn't be null.  It wouldn't make much more sense to emit a
warningthere than it would be in this situation: 

CREATE TABLE t (i int NULL);
ALTER TABLE t ALTER i SET NOT NULL;

--
Adrian Klaver
adrian.klaver@aklaver.com







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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Is this a buggy behavior?
Следующее
От: Thiemo Kellner
Дата:
Сообщение: Re: Is this a buggy behavior?