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

yanliang lei <msdnchina@163.com>

From: "yanliang lei" <msdnchina@163.com>
To: Álvaro Herrera <alvherre@kurilemu.de>
Cc: "Srinath Reddy Sadipiralla" <srinath2133@gmail.com>, pgsql-bugs@lists.postgresql.org
Date: 2025-12-13T04:15:53Z
Lists: pgsql-bugs
hi


I'm sorry, I didn't notice your reply. I just read your reply and I'm sorry, as I am the end user of the database and not a developer of the database, I don't know how to find commit 14e87ffa5c54.


From the perspective of the end user of the database,In PostgreSQL 18,


Step 1: After the successful execution of "create table test_null_20251210 (c1 int not null, c2 text);", 
PostgreSQL 18  will automatically create a not null constraint name for column c1, and the constraint name is  "test_null_20251210uc1_not_null",


Step 2: The execution of 'alter table test_null_20251210 add constraint xyzxyz not null c1' did not return any errors.


after the execution of Step 2 , the executing user of the SQL statement "alter table test_null_20251210 add constraint xyzxyz not null c1" in the Step 2 will assume (because there was no error prompt in the  Step 2   ) that the not null constraint has been successfully added to column c1, and the name of the constraint is xyzxyz.
 ----However, in reality, based on the execution results of the SQL database, the Step 2 did not actually succeed.


So, based on this situation,
I believe that there is a problem with the execution result of the Step 2 not reporting an error, which can mislead the user executing the SQL statement in Step 2.

At 2025-12-12 23:01:53, "Álvaro Herrera" <alvherre@kurilemu.de> wrote:
>On 2025-Dec-12, yanliang lei wrote:
>
>> Thanks for replying .
>> 
>> in the postgresql 18 ,not null has “Constraint Name”,and this is a PostgreSQL 18  New Feature.
>> 
>> so , i think that: this problem(BUG #19351) is a bug.
>
>Did you read my other reply?
>https://www.postgresql.org/message-id/202512110716.jpbcheffhdow%40alvherre.pgsql
>
>-- 
>Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
>"Right now the sectors on the hard disk run clockwise, but I heard a rumor that
>you can squeeze 0.2% more throughput by running them counterclockwise.
>It's worth the effort. Recommended."  (Gerry Pourwelle)