Re: Proposal: Include CHECK constraint expression in violation error DETAIL

From: Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp>
To: Yash Jadhav <yash(dot)jadhav8008(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
Date: 2026-11-18 01:53:30
Message-ID: TY7P286MB974944B4083CD9C5C252188B7F947A2@TY7P286MB974944.JPNP286.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Hi Yash,
>
> Thank you for investigating the cfbot failures and providing the
expected-output update.
>
> I incorporated your changes to
> contrib/postgres_fdw/expected/postgres_fdw.out into the next version of
> the patch. The failures were caused by the newly added CHECK constraint
> expression changing the DETAIL text, while the postgres_fdw expected
> output still contained the previous messages.
>
> After merging the changes, I ran:
>
> make -C contrib/postgres_fdw check
>
> and all postgres_fdw regression tests passed successfully. I will
> include the updated expected output in the next patch version.
>
> Thanks again for catching the missing regression test updates.
>
> Regards,

Hi,

In addition to table CHECK constraints, I thought it would also be
useful to report the violated expression for domain CHECK constraints,
so I updated the patch to cover them as well.

For example, given a domain with a CHECK constraint, a violation is now
reported as follows:

ERROR: value for domain positive_int violates check constraint "positive_int_check"
DETAIL: Check constraint expression: (VALUE > 0).

Here, VALUE denotes the value being coerced to the domain, as in the
original domain CHECK expression.

I also added regression coverage for domain constraint violations and
updated the affected expected output files. The postgres_fdw expected
output fix provided by Yash is included as well.

The updated patch is attached.

Regards,

Taiki Koshino<koshino(at)sraoss(dot)co(dot)jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/

________________________________
差出人: Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp>
送信日時: 2026年11月17日 17:58
宛先: Yash Jadhav <yash(dot)jadhav8008(at)gmail(dot)com>
CC: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL

Hi Yash,

Thank you for investigating the cfbot failures and providing the
expected-output update.

I incorporated your changes to
contrib/postgres_fdw/expected/postgres_fdw.out into the next version of
the patch. The failures were caused by the newly added CHECK constraint
expression changing the DETAIL text, while the postgres_fdw expected
output still contained the previous messages.

After merging the changes, I ran:

make -C contrib/postgres_fdw check

and all postgres_fdw regression tests passed successfully. I will
include the updated expected output in the next patch version.

Thanks again for catching the missing regression test updates.

Regards,

Taiki Koshino<koshino(at)sraoss(dot)co(dot)jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/

________________________________
差出人: Yash Jadhav <yash(dot)jadhav8008(at)gmail(dot)com>
送信日時: 2026年11月15日 18:54
宛先: Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp>
CC: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>; Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL

Hi,

cfbot is failing on v2 in the contrib/postgres_fdw regression test
(Linux Autoconf, Linux Meson, and others). Its expected output still
has the old DETAIL text for several check constraint violations.

I’ve attached a patch that updates
contrib/postgres_fdw/expected/postgres_fdw.out. I applied it on top of
v2, and make -C contrib/postgres_fdw check passes.

The attachment is named nocfbot, so cfbot doesn’t treat it as a
replacement for the patch set. You can apply the change into your next
version.

Regards,
Yash

Attachment Content-Type Size
v4-0001-Report-CHECK-expression-in-constraint-violation-d.patch application/octet-stream 98.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2026-11-18 02:22:07 Re: create .abi-compliance-history file for v19
Previous Message Ajin Cherian 2026-11-18 01:12:07 Re: Initial table sync copies the whole table when it is no longer published