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?