Re: BUG #19351: in pg18.1,when not null exists in the table , and add constraint problem.

Поиск
Список
Период
Сортировка
От Srinath Reddy Sadipiralla
Тема Re: BUG #19351: in pg18.1,when not null exists in the table , and add constraint problem.
Дата
Msg-id CAFC+b6q7xFQN=wRP0rOCLat=rWNNNhuhEKOUV-2BJ9HxU5SrAQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #19351: in pg18.1,when not null exists in the table , and add constraint problem.  (Srinath Reddy Sadipiralla <srinath2133@gmail.com>)
Ответы Re: BUG #19351: in pg18.1,when not null exists in the table , and add constraint problem.
Список pgsql-bugs


On Wed, Dec 10, 2025 at 9:32 PM Srinath Reddy Sadipiralla <srinath2133@gmail.com> wrote:
why it's not treated as normal
constraint and why we are not throwing an error
like the constraint already exists?

ah... just after a quick code lookup, remembered that
"not null" is treated as a column property, which is a
flag in pg_attribute catalog table named as "attnotnull",
i guess the reason(s) it's a column property rather than
constraint might be an overkill, adds overhead of entries
in pg_constraint, or historical reasons, please correct me
if i am wrong, still the right way of setting this constraint "ALTER TABLE test_null_20251210 ALTER COLUMN c1 SET NOT NULL;"
not throwing an error; i think it makes sense to throw an
error here, thoughts?

--
Thanks,
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/

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