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

From: Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>
To: msdnchina(at)163(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19351: in pg18.1,when not null exists in the table , and add constraint problem.
Date: 2025-12-10 16:40:02
Message-ID: CAFC+b6q7xFQN=wRP0rOCLat=rWNNNhuhEKOUV-2BJ9HxU5SrAQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Dec 10, 2025 at 9:32 PM Srinath Reddy Sadipiralla <
srinath2133(at)gmail(dot)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/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Haowu Ge 2025-12-11 02:32:51 Re: GROUP BY ROLLUP queries on views trigger full table scans (index usage not optimized)
Previous Message Tom Lane 2025-12-10 16:07:01 Re: BUG #19350: Short circuit optimization missed when running sqlscriptes in JDBC