Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-07-03 Thread Álvaro Herrera
On 2025-Jul-03, Fujii Masao wrote: > If we go with it, I’m slightly inclined to add [ ENFORCED ] to > the CREATE TRIGGER syntax in the docs. Without that, users might be confused > or raise concerns that CREATE CONSTRAINT TRIGGER accepts an option > (i.e., ENFORCED) that isn't actually documented

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-07-02 Thread Fujii Masao
On 2025/07/03 0:31, Álvaro Herrera wrote: On 2025-Jul-02, Fujii Masao wrote: Regarding the 0003 patch: + if (($11 & CAS_NOT_ENFORCED) != 0) + ereport(ERROR, +

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-07-02 Thread Álvaro Herrera
On 2025-Jul-02, Fujii Masao wrote: > Regarding the 0003 patch: > > + if (($11 & CAS_NOT_ENFORCED) != 0) > + ereport(ERROR, > + > errmsg("constraint triggers

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-07-02 Thread Fujii Masao
On 2025/07/02 23:31, Fujii Masao wrote: On 2025/07/01 3:27, Álvaro Herrera wrote: On 2025-Jun-30, Álvaro Herrera wrote: Just one note: Jian's patch doesn't handle the same issue for TRIGGER case, so that part might still need to be addressed. Okay, here's my take on this, wherein I rewo

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-07-02 Thread Fujii Masao
On 2025/07/01 3:27, Álvaro Herrera wrote: On 2025-Jun-30, Álvaro Herrera wrote: Just one note: Jian's patch doesn't handle the same issue for TRIGGER case, so that part might still need to be addressed. Okay, here's my take on this, wherein I reworded the proposed error message. I also ha

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-06-30 Thread Álvaro Herrera
On 2025-Jun-30, Álvaro Herrera wrote: > > Just one note: Jian's patch doesn't handle the same issue for TRIGGER > > case, so that part might still need to be addressed. > > Okay, here's my take on this, wherein I reworded the proposed error > message. I also handled the NOT VALID case of a const

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-06-30 Thread Álvaro Herrera
On 2025-Jun-27, Fujii Masao wrote: > On 2025/06/27 22:30, Álvaro Herrera wrote: > > On 2025-06-27, Fujii Masao wrote: > > > > > To make this distinction, I just started thinking it's better to raise > > > the error > > > in ATExecAlterConstraint() rather than in gram.y. I've attached a draft > >

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-06-27 Thread Fujii Masao
On 2025/06/27 22:30, Álvaro Herrera wrote: On 2025-06-27, Fujii Masao wrote: To make this distinction, I just started thinking it's better to raise the error in ATExecAlterConstraint() rather than in gram.y. I've attached a draft patch that follows this approach. Hmm I don't like this very

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-06-27 Thread Álvaro Herrera
On 2025-06-27, Fujii Masao wrote: > To make this distinction, I just started thinking it's better to raise > the error > in ATExecAlterConstraint() rather than in gram.y. I've attached a draft > patch that > follows this approach. Hmm I don't like this very much, it feels very kludgy. I think i

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-06-27 Thread jian he
On Fri, Jun 27, 2025 at 2:11 PM Fujii Masao wrote: > > I had this concern because other commands, like ALTER SEQUENCE ALTER > CONSTRAINT NOT VALID, > can also hit this error, and seeing an error message that starts with ALTER > TABLE ... > in that context can be confusing. That's why I thought a

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-06-26 Thread Fujii Masao
On 2025/06/18 1:00, Fujii Masao wrote: I had overlooked that commands other than ALTER TABLE can also trigger this error. So mentioning just ALTER TABLE ... might be a bit misleading. Would it be better to use a message like "ALTER action ALTER CONSTRAINT ... NOT VALID is not supported", simila

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-06-17 Thread Fujii Masao
On 2025/06/13 16:10, jian he wrote: On Wed, Jun 11, 2025 at 10:20 PM Fujii Masao wrote: We discussed this already, didn't we? There's a thread with IIRC three proposed patches for this. I think I liked this one the most: https://postgr.es/m/caaj_b97hd-jmts7ajgu6tdbczdx_kyukxg+k-dtymoieg

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-06-13 Thread jian he
On Wed, Jun 11, 2025 at 10:20 PM Fujii Masao wrote: > > >> We discussed this already, didn't we? There's a thread with IIRC three > >> proposed patches for this. I think I liked this one the most: > >> > >> https://postgr.es/m/caaj_b97hd-jmts7ajgu6tdbczdx_kyukxg+k-dtymoieg+g...@mail.gmail.com >

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-06-11 Thread Fujii Masao
On 2025/06/02 12:13, jian he wrote: On Wed, May 28, 2025 at 7:59 PM Álvaro Herrera wrote: On 2025-May-28, jian he wrote: hi. create table t(a int, constraint cc check(a = 1)); ALTER TABLE t ALTER CONSTRAINT cc not valid; ERROR: FOREIGN KEY constraints cannot be marked NOT VALID LINE 1:

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-06-01 Thread jian he
On Wed, May 28, 2025 at 7:59 PM Álvaro Herrera wrote: > > On 2025-May-28, jian he wrote: > > > hi. > > > > create table t(a int, constraint cc check(a = 1)); > > ALTER TABLE t ALTER CONSTRAINT cc not valid; > > ERROR: FOREIGN KEY constraints cannot be marked NOT VALID > > LINE 1: ALTER TABLE t A

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-05-28 Thread Álvaro Herrera
On 2025-May-28, jian he wrote: > hi. > > create table t(a int, constraint cc check(a = 1)); > ALTER TABLE t ALTER CONSTRAINT cc not valid; > ERROR: FOREIGN KEY constraints cannot be marked NOT VALID > LINE 1: ALTER TABLE t ALTER CONSTRAINT cc not valid; >

Re: ALTER TABLE ALTER CONSTRAINT misleading error message

2025-05-28 Thread Tender Wang
jian he 于2025年5月28日周三 17:10写道: > hi. > > create table t(a int, constraint cc check(a = 1)); > ALTER TABLE t ALTER CONSTRAINT cc not valid; > ERROR: FOREIGN KEY constraints cannot be marked NOT VALID > LINE 1: ALTER TABLE t ALTER CONSTRAINT cc not valid; >

ALTER TABLE ALTER CONSTRAINT misleading error message

2025-05-28 Thread jian he
hi. create table t(a int, constraint cc check(a = 1)); ALTER TABLE t ALTER CONSTRAINT cc not valid; ERROR: FOREIGN KEY constraints cannot be marked NOT VALID LINE 1: ALTER TABLE t ALTER CONSTRAINT cc not valid; ^ the error message seems misleading, shou