Re: ALTER TABLE ALTER CONSTRAINT misleading error message

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: ALTER TABLE ALTER CONSTRAINT misleading error message
Date: 2025-07-02 15:31:46
Message-ID: 202507021531.hph35jpzrz6b@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025-Jul-02, Fujii Masao wrote:

> Regarding the 0003 patch:
>
> + if (($11 & CAS_NOT_ENFORCED) != 0)
> + ereport(ERROR,
> + errmsg("constraint triggers cannot be marked %s",
> + "NOT ENFORCED"),
> + parser_errposition(@11));
>
> Shouldn't we also raise an error when CAS_ENFORCED is given?

Great point -- ENFORCED can also throw the bogus error. However, if you
say ENFORCED, the constraint is going to be enforced, which is the same
that happens if you don't say anything, so I think we should accept the
case. So how about this?

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"This is a foot just waiting to be shot" (Andrew Dunstan)

Attachment Content-Type Size
v6-0001-Fix-bogus-grammar-for-a-CREATE-CONSTRAINT-TRIGGER.patch text/x-diff 5.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-07-02 15:36:01 Re: Allow the "operand" input of width_bucket() to be NaN
Previous Message Jianghua Yang 2025-07-02 15:03:05 Re: [PATCH] initdb: Treat empty -U argument as unset username