Proposal: Include CHECK constraint expression in violation error DETAIL
Proposal: Include CHECK constraint expression in violation error DETAIL
Hi,
When a CHECK constraint is violated, PostgreSQL reports the constraint name
and the failing row, but not the constraint expression:
ERROR: new row for relation "staff_sales" violates check constraint "staff_age_check"
DETAIL: Failing row contains (1, 15).
Users need to inspect the table with \d to find the violated condition.
Is there a reason why the expression is not included in the error detail?
(For example, having such information appear in logs could pose a
security risk.)
Including it in DETAIL would avoid this extra step:
DETAIL: Failing row contains (1, 15). Check constraint expression: (age >= 18).
I have attached a concept patch to illustrate the idea. Please note that
this is a work in progress.
For the implementation, I wrote the expression generation by referring to
pg_get_constraintdef_worker().
Regarding security, I have not yet added any permission checks. I plan to
investigate whether they are needed at all, and if so what form they should
take, using the existing handling of the failing-row detail and the
previous proposal that was already committed as references:
<https://www.postgresql.org/message-id/flat/9f9dc7ae-14f0-4a25-5485-964d9bfc19bd%40lab.ntt.co.jp>
If this proposal is considered worthwhile, I would like to continue
developing the patch myself.
Regards,
Taiki Koshino<koshino@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
Re: Proposal: Include CHECK constraint expression in violation error DETAIL
От:
Yash Jadhav <yash.jadhav8008@gmail.com>
Дата:
Hi, I went through the patch and have a few thoughts on the security question. > Is there a reason why the expression is not included in the error detail? > (For example, having such information appear in logs could pose a > security risk.) For clients: any role can read CHECK expressions from, including for tables it has no privileges on, so printing the expression doesn't seem to expose anything new. For the server log: an error entry already contains the table, column and constraint names, so expression looks less sensitive compared to them. Anything I should improve on? Regards, Yash
Re: Proposal: Include CHECK constraint expression in violation error DETAIL
От:
Koshino Taiki <koshino@sraoss.co.jp>
Дата:
Hi Yash,
Thank you for reviewing the patch.
> For clients: any role can read CHECK expressions from, including for
> tables it has no privileges on, so printing the expression doesn't
> seem to expose anything new.
>
> For the server log: an error entry already contains the table, column
> and constraint names, so expression looks less sensitive compared to
> them.
>
> Anything I should improve on?
> tables it has no privileges on, so printing the expression doesn't
> seem to expose anything new.
>
> For the server log: an error entry already contains the table, column
> and constraint names, so expression looks less sensitive compared to
> them.
>
> Anything I should improve on?
I agree that no additional security control seems necessary.
When the user has sufficient privileges to display the failing row, the client receives:
ERROR: new row for relation "check_detail_test" violates check constraint "age_check"
DETAIL: Failing row contains (15). Check constraint expression: (age >= 18).
When the user does not have sufficient privileges to display the failing row,
ExecBuildSlotValueDescription() returns NULL. The existing
"val_desc ? ... : 0" check then omits the entire DETAIL message:
ERROR: new row for relation "check_detail_test" violates check constraint "age_check"
The same applies to the server log because the DETAIL field is constructed by
the same code. Therefore, the CHECK expression is not sent to the client or
written to the server log when the failing row detail is suppressed.
I am preparing regression test fixes and will send an updated patch when they are
ready.
Regards,
Koshino
Taiki Koshino<koshino@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
差出人: Yash Jadhav <yash.jadhav8008@gmail.com>
送信日時: 2026年10月30日 4:23
宛先: Koshino Taiki <koshino@sraoss.co.jp>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Yugo Nagata <nagata@sraoss.co.jp>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
送信日時: 2026年10月30日 4:23
宛先: Koshino Taiki <koshino@sraoss.co.jp>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Yugo Nagata <nagata@sraoss.co.jp>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
Hi,
I went through the patch and have a few thoughts on the security question.
> Is there a reason why the expression is not included in the error detail?
> (For example, having such information appear in logs could pose a
> security risk.)
For clients: any role can read CHECK expressions from, including for
tables it has no privileges on, so printing the expression doesn't
seem to expose anything new.
For the server log: an error entry already contains the table, column
and constraint names, so expression looks less sensitive compared to
them.
Anything I should improve on?
Regards,
Yash
I went through the patch and have a few thoughts on the security question.
> Is there a reason why the expression is not included in the error detail?
> (For example, having such information appear in logs could pose a
> security risk.)
For clients: any role can read CHECK expressions from, including for
tables it has no privileges on, so printing the expression doesn't
seem to expose anything new.
For the server log: an error entry already contains the table, column
and constraint names, so expression looks less sensitive compared to
them.
Anything I should improve on?
Regards,
Yash
Re: Proposal: Include CHECK constraint expression in violation error DETAIL
Hi,
Attached is v2 of the patch for adding test.
This version updates the regression test expected output for the changed
CHECK constraint violation details. I also confirmed that all regression
tests pass.
Regards,
Taiki Koshino<koshino@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
差出人: Koshino Taiki <koshino@sraoss.co.jp>
送信日時: 2026年10月30日 18:29
宛先: Yash Jadhav <yash.jadhav8008@gmail.com>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Yugo Nagata <nagata@sraoss.co.jp>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
送信日時: 2026年10月30日 18:29
宛先: Yash Jadhav <yash.jadhav8008@gmail.com>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Yugo Nagata <nagata@sraoss.co.jp>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
Hi Yash,
Thank you for reviewing the patch.
> For clients: any role can read CHECK expressions from, including for
> tables it has no privileges on, so printing the expression doesn't
> seem to expose anything new.
>
> For the server log: an error entry already contains the table, column
> and constraint names, so expression looks less sensitive compared to
> them.
>
> Anything I should improve on?
> tables it has no privileges on, so printing the expression doesn't
> seem to expose anything new.
>
> For the server log: an error entry already contains the table, column
> and constraint names, so expression looks less sensitive compared to
> them.
>
> Anything I should improve on?
I agree that no additional security control seems necessary.
When the user has sufficient privileges to display the failing row, the client receives:
ERROR: new row for relation "check_detail_test" violates check constraint "age_check"
DETAIL: Failing row contains (15). Check constraint expression: (age >= 18).
When the user does not have sufficient privileges to display the failing row,
ExecBuildSlotValueDescription() returns NULL. The existing
"val_desc ? ... : 0" check then omits the entire DETAIL message:
ERROR: new row for relation "check_detail_test" violates check constraint "age_check"
The same applies to the server log because the DETAIL field is constructed by
the same code. Therefore, the CHECK expression is not sent to the client or
written to the server log when the failing row detail is suppressed.
I am preparing regression test fixes and will send an updated patch when they are
ready.
Regards,
Koshino
Taiki Koshino<koshino@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
差出人: Yash Jadhav <yash.jadhav8008@gmail.com>
送信日時: 2026年10月30日 4:23
宛先: Koshino Taiki <koshino@sraoss.co.jp>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Yugo Nagata <nagata@sraoss.co.jp>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
送信日時: 2026年10月30日 4:23
宛先: Koshino Taiki <koshino@sraoss.co.jp>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Yugo Nagata <nagata@sraoss.co.jp>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
Hi,
I went through the patch and have a few thoughts on the security question.
> Is there a reason why the expression is not included in the error detail?
> (For example, having such information appear in logs could pose a
> security risk.)
For clients: any role can read CHECK expressions from, including for
tables it has no privileges on, so printing the expression doesn't
seem to expose anything new.
For the server log: an error entry already contains the table, column
and constraint names, so expression looks less sensitive compared to
them.
Anything I should improve on?
Regards,
Yash
I went through the patch and have a few thoughts on the security question.
> Is there a reason why the expression is not included in the error detail?
> (For example, having such information appear in logs could pose a
> security risk.)
For clients: any role can read CHECK expressions from, including for
tables it has no privileges on, so printing the expression doesn't
seem to expose anything new.
For the server log: an error entry already contains the table, column
and constraint names, so expression looks less sensitive compared to
them.
Anything I should improve on?
Regards,
Yash
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
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@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
差出人: Yash Jadhav <yash.jadhav8008@gmail.com>
送信日時: 2026年11月15日 18:54
宛先: Koshino Taiki <koshino@sraoss.co.jp>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Yugo Nagata <nagata@sraoss.co.jp>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
送信日時: 2026年11月15日 18:54
宛先: Koshino Taiki <koshino@sraoss.co.jp>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Yugo Nagata <nagata@sraoss.co.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
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
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,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@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
差出人: Koshino Taiki <koshino@sraoss.co.jp>
送信日時: 2026年11月17日 17:58
宛先: Yash Jadhav <yash.jadhav8008@gmail.com>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
送信日時: 2026年11月17日 17:58
宛先: Yash Jadhav <yash.jadhav8008@gmail.com>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.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@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
差出人: Yash Jadhav <yash.jadhav8008@gmail.com>
送信日時: 2026年11月15日 18:54
宛先: Koshino Taiki <koshino@sraoss.co.jp>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Yugo Nagata <nagata@sraoss.co.jp>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
送信日時: 2026年11月15日 18:54
宛先: Koshino Taiki <koshino@sraoss.co.jp>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Yugo Nagata <nagata@sraoss.co.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
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
Re: Proposal: Include CHECK constraint expression in violation error DETAIL
> 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,
Hi, I updated the patch so that it applies cleanly to the latest master. The conflicts in execExpr.c and sqljson_queryfuncs.out have been resolved while preserving the recent changes on master. The relevant regression tests also pass. The updated v5 patch is attached. Regards,
Taiki Koshino<koshino@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
差出人: Koshino Taiki <koshino@sraoss.co.jp>
送信日時: 2026年11月18日 10:53
宛先: Yash Jadhav <yash.jadhav8008@gmail.com>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
送信日時: 2026年11月18日 10:53
宛先: Yash Jadhav <yash.jadhav8008@gmail.com>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.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,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@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
差出人: Koshino Taiki <koshino@sraoss.co.jp>
送信日時: 2026年11月17日 17:58
宛先: Yash Jadhav <yash.jadhav8008@gmail.com>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
送信日時: 2026年11月17日 17:58
宛先: Yash Jadhav <yash.jadhav8008@gmail.com>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.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@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
差出人: Yash Jadhav <yash.jadhav8008@gmail.com>
送信日時: 2026年11月15日 18:54
宛先: Koshino Taiki <koshino@sraoss.co.jp>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Yugo Nagata <nagata@sraoss.co.jp>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
送信日時: 2026年11月15日 18:54
宛先: Koshino Taiki <koshino@sraoss.co.jp>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Yugo Nagata <nagata@sraoss.co.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
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
Re: Proposal: Include CHECK constraint expression in violation error DETAIL
> Hi, > > I updated the patch so that it applies cleanly to the latest master. > The conflicts in execExpr.c and sqljson_queryfuncs.out have been > resolved while preserving the recent changes on master. > > The relevant regression tests also pass. The updated v5 patch is > attached. > > Regards,Hi, Attached is v6 of the patch. This version has been rebased onto the latest master. It includes the expected-output updates for postgres_fdw, hstore_plpython, PL/Perl, PL/Python, and PL/Tcl. The patch reports the violated expression for both table and domain CHECK constraints. For example: ERROR: value for domain positive_int violates check constraint "positive_int_check" DETAIL: Check constraint expression: (VALUE > 0). I ran make check-world with PL/Perl, PL/Python, and PL/Tcl enabled, and all tests passed. Regards,
Taiki Koshino<koshino@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
差出人: Koshino Taiki <koshino@sraoss.co.jp>
送信日時: 2026年11月18日 15:28
宛先: Yash Jadhav <yash.jadhav8008@gmail.com>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
送信日時: 2026年11月18日 15:28
宛先: Yash Jadhav <yash.jadhav8008@gmail.com>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
> 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,
Hi, I updated the patch so that it applies cleanly to the latest master. The conflicts in execExpr.c and sqljson_queryfuncs.out have been resolved while preserving the recent changes on master. The relevant regression tests also pass. The updated v5 patch is attached. Regards,
Taiki Koshino<koshino@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
差出人: Koshino Taiki <koshino@sraoss.co.jp>
送信日時: 2026年11月18日 10:53
宛先: Yash Jadhav <yash.jadhav8008@gmail.com>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
送信日時: 2026年11月18日 10:53
宛先: Yash Jadhav <yash.jadhav8008@gmail.com>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.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,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@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
差出人: Koshino Taiki <koshino@sraoss.co.jp>
送信日時: 2026年11月17日 17:58
宛先: Yash Jadhav <yash.jadhav8008@gmail.com>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
送信日時: 2026年11月17日 17:58
宛先: Yash Jadhav <yash.jadhav8008@gmail.com>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.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@sraoss.co.jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/
差出人: Yash Jadhav <yash.jadhav8008@gmail.com>
送信日時: 2026年11月15日 18:54
宛先: Koshino Taiki <koshino@sraoss.co.jp>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Yugo Nagata <nagata@sraoss.co.jp>
件名: Re: Proposal: Include CHECK constraint expression in violation error DETAIL
送信日時: 2026年11月15日 18:54
宛先: Koshino Taiki <koshino@sraoss.co.jp>
CC: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Yugo Nagata <nagata@sraoss.co.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
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