pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feedE.6.3.2.1. Constraints
10+ messages / 6 participants
[nested] [flat]
Commits from this thread:
2026-10-23 9412c35035 doc PG 18 relnotes: add incompatibility item about SQLSTATE
* E.6.3.2.1. Constraints
@ 2026-09-19 14:49 PG Doc comments form <noreply@postgresql.org>
0 siblings, 1 reply; 10+ messages in thread
From: PG Doc comments form @ 2026-09-19 14:49 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org; +Cc: kacperkuras@hotmail.com
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/18/release-18.html
Description:
Commit 086c84b23 changed what a foreign key with ON DELETE RESTRICT or ON
UPDATE RESTRICT raises when it refuses a change: SQLSTATE 23001
(restrict_violation) instead of 23503 (foreign_key_violation), and the
message now says "violates RESTRICT setting of foreign key constraint". The
PostgreSQL 18 release notes do not mention it.
Code that catches 23503 to report that a row is still referenced stops
matching RESTRICT keys after upgrading, while NO ACTION keys still raise
23503. The same notes list the change to the XML error codes (cd838e200), so
this one seems to belong there as well.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: E.6.3.2.1. Constraints
@ 2026-09-21 19:08 Bruce Momjian <bruce@momjian.us>
parent: PG Doc comments form <noreply@postgresql.org>
0 siblings, 1 reply; 10+ messages in thread
From: Bruce Momjian @ 2026-09-21 19:08 UTC (permalink / raw)
To: kacperkuras@hotmail.com; pgsql-docs@lists.postgresql.org
tOn Sat, Sep 19, 2026 at 02:49:55PM +0000, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/18/release-18.html
> Description:
>
> Commit 086c84b23 changed what a foreign key with ON DELETE RESTRICT or ON
> UPDATE RESTRICT raises when it refuses a change: SQLSTATE 23001
> (restrict_violation) instead of 23503 (foreign_key_violation), and the
> message now says "violates RESTRICT setting of foreign key constraint". The
> PostgreSQL 18 release notes do not mention it.
>
> Code that catches 23503 to report that a row is still referenced stops
> matching RESTRICT keys after upgrading, while NO ACTION keys still raise
> 23503. The same notes list the change to the XML error codes (cd838e200), so
> this one seems to belong there as well.
How do we want to handle such cases in the release notes? The new codes
are not mentioned in the commit message, and there are no doc changes in the
patch. We have a similar commit from August, which was later reverted:
commit c16a1b4f2ce
Author: Peter Eisentraut <peter@eisentraut.org>
Date: Fri Aug 21 13:55:58 2026 +0200
Fix error code for null FOR PORTION OF target
When the target expression of FOR PORTION OF (...) evaluated to NULL,
ExecInitModifyTable raised an error without an errcode, so clients got
the internal error code XX000 for a user-reachable condition.
Oversight in commit 8e72d914c52.
To fix, report ERRCODE_NULL_VALUE_NOT_ALLOWED, and reword the message
to "FOR PORTION OF target must not be null", matching similar executor
messages such as "frame starting offset must not be null".
Bug: #19630
Reported-by: Zheng Wang <hackerzheng666@gmail.com>
Reported-by: Yanjie Zhao
Reported-by: Yiyang Liu
Author: Zsolt Parragi <zsolt.parragi@percona.com>
Discussion: https://www.postgresql.org/message-id/flat/19630-9f10ca28426295fa%40postgresql.org
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Do not let urgent matters crowd out time for investment in the future.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: E.6.3.2.1. Constraints
@ 2026-09-22 05:51 Laurenz Albe <laurenz.albe@cybertec.at>
parent: Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 10+ messages in thread
From: Laurenz Albe @ 2026-09-22 05:51 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; kacperkuras@hotmail.com; pgsql-docs@lists.postgresql.org
On Mon, 2026-09-21 at 15:08 -0400, Bruce Momjian wrote:
> On Sat, Sep 19, 2026 at 02:49:55PM +0000, PG Doc comments form wrote:
> > The following documentation comment has been logged on the website:
> >
> > Page: https://www.postgresql.org/docs/18/release-18.html
> > Description:
> >
> > Commit 086c84b23 changed what a foreign key with ON DELETE RESTRICT or ON
> > UPDATE RESTRICT raises when it refuses a change: SQLSTATE 23001
> > (restrict_violation) instead of 23503 (foreign_key_violation), and the
> > message now says "violates RESTRICT setting of foreign key constraint". The
> > PostgreSQL 18 release notes do not mention it.
> >
> > Code that catches 23503 to report that a row is still referenced stops
> > matching RESTRICT keys after upgrading, while NO ACTION keys still raise
> > 23503. The same notes list the change to the XML error codes (cd838e200), so
> > this one seems to belong there as well.
>
> How do we want to handle such cases in the release notes? The new codes
> are not mentioned in the commit message, and there are no doc changes in the
> patch.
In my opinion, that should have a place in the "migration to v19" section of
incompatibilities in the release notes.
I have no right to burden committers even more, but I'd say that such changes
should be part of the commit message.
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: E.6.3.2.1. Constraints
@ 2026-09-22 06:37 Daniel Gustafsson <daniel@yesql.se>
parent: Laurenz Albe <laurenz.albe@cybertec.at>
0 siblings, 1 reply; 10+ messages in thread
From: Daniel Gustafsson @ 2026-09-22 06:37 UTC (permalink / raw)
To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: Bruce Momjian <bruce@momjian.us>; Kacper Kuras <kacperkuras@hotmail.com>; pgsql-docs@lists.postgresql.org
> On 22 Sep 2026, at 07:51, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> I have no right to burden committers even more, but I'd say that such changes
> should be part of the commit message.
Not commenting on the specific commit or change here, but in general I think it
would be good if we started adding incompatabilities and upgrade notes to the
release notes over the development cycle rather than trying to collect them at
the end. It's fine to add a rough text which can be copy edited (or even
removed if deemed too minor) as the release notes process takes place, but
having it in the same commit as the change should ideally mean less work at the
end of the cycle and fewer missed notes.
--
Daniel Gustafsson
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: E.6.3.2.1. Constraints
@ 2026-09-22 13:40 Bruce Momjian <bruce@momjian.us>
parent: Daniel Gustafsson <daniel@yesql.se>
0 siblings, 2 replies; 10+ messages in thread
From: Bruce Momjian @ 2026-09-22 13:40 UTC (permalink / raw)
To: Daniel Gustafsson <daniel@yesql.se>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; Kacper Kuras <kacperkuras@hotmail.com>; pgsql-docs@lists.postgresql.org
On Tue, Sep 22, 2026 at 08:37:42AM +0200, Daniel Gustafsson wrote:
> > On 22 Sep 2026, at 07:51, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
>
> > I have no right to burden committers even more, but I'd say that such changes
> > should be part of the commit message.
>
> Not commenting on the specific commit or change here, but in general I think it
> would be good if we started adding incompatibilities and upgrade notes to the
> release notes over the development cycle rather than trying to collect them at
> the end. It's fine to add a rough text which can be copy edited (or even
> removed if deemed too minor) as the release notes process takes place, but
> having it in the same commit as the change should ideally mean less work at the
> end of the cycle and fewer missed notes.
Actually, many committers already mark incompatibilities and mention the
release notes in their commit messages. My question here is whether
error code changes are incompatibilities worthy of being mentioned in
the release notes, and if committers don't mention this in the commit
message, how would I find them when creating the release notes?
I wonder if this should be discussed on hackers instead?
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Do not let urgent matters crowd out time for investment in the future.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: E.6.3.2.1. Constraints
@ 2026-10-03 18:43 Kacper Kuras <kacperkuras@hotmail.com>
parent: Bruce Momjian <bruce@momjian.us>
1 sibling, 0 replies; 10+ messages in thread
From: Kacper Kuras @ 2026-10-03 18:43 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>; Daniel Gustafsson <daniel@yesql.se>
> My question here is whether error code changes are incompatibilities
> worthy of being mentioned in the release notes, and if committers
> don't mention this in the commit message, how would I find them when
> creating the release notes?
The 18 notes already list one SQLSTATE change, cd838e200 for XML
errors, so leaving out 086c84b23 makes them inconsistent: both change
what code an application gets for the same error.
I can see why it was missed, though. The commit message presents it
as following the standard rather than as a behavior change, and
nothing in errcodes.txt changed: cd838e200 added new codes there,
while 086c84b23 started using 23001, which had been defined but unused
since 2003 (7.4).
So I think it belongs next to cd838e200 in the version 18 notes (it
went into 18.0, not 19). The general question is a good one for
hackers, but could this case be handled on its own?
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: E.6.3.2.1. Constraints
@ 2026-10-05 01:40 David Rowley <dgrowleyml@gmail.com>
parent: Bruce Momjian <bruce@momjian.us>
1 sibling, 1 reply; 10+ messages in thread
From: David Rowley @ 2026-10-05 01:40 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: Daniel Gustafsson <daniel@yesql.se>; Laurenz Albe <laurenz.albe@cybertec.at>; Kacper Kuras <kacperkuras@hotmail.com>; pgsql-docs@lists.postgresql.org
On Wed, 23 Sept 2026 at 01:40, Bruce Momjian <bruce@momjian.us> wrote:
> Actually, many committers already mark incompatibilities and mention the
> release notes in their commit messages. My question here is whether
> error code changes are incompatibilities worthy of being mentioned in
> the release notes, and if committers don't mention this in the commit
> message, how would I find them when creating the release notes?
I think error code changes are worthy of a release note mention.
People doing light testing of applications on newer versions might not
notice the broken error handling because error conditions might be
rare. This particular one may need a concurrent user to update a
record, so a breakage might not be noticed easily.
Not sure about the committers part. What would catch your attention
the best? A new tag? or mentioning "release notes" in the commit
message? Despite the odd typo, committers seem to be quite good at
using tags. They stand out quite well and it's easy to see what others
do and copy that. This one might only appear rarely, so it might not
work quite as well. Mentioning it in
https://wiki.postgresql.org/wiki/Commit_Message_Guidance would likely
help.
If the committer neglects to do that, I don't think you can be
expected to figure all these out from looking at the code changes.
Doing the release notes looks like a hard enough job already.
> I wonder if this should be discussed on hackers instead?
Probably.
David
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: E.6.3.2.1. Constraints
@ 2026-10-10 12:41 Kacper Kuras <kacperkuras@hotmail.com>
parent: David Rowley <dgrowleyml@gmail.com>
0 siblings, 1 reply; 10+ messages in thread
From: Kacper Kuras @ 2026-10-10 12:41 UTC (permalink / raw)
To: David Rowley <dgrowleyml@gmail.com>; +Cc: Daniel Gustafsson <daniel@yesql.se>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>; Peter Eisentraut <peter@eisentraut.org>; Bruce Momjian <bruce@momjian.us>
Here is a patch for this case, against REL_18_STABLE, that adds
086c84b23 to the 18 release notes:
Report RESTRICT foreign key violations with SQLSTATE 23001
(restrict_violation) instead of 23503 (foreign_key_violation)
(Peter Eisentraut)
I put it in the Constraints section with the other foreign key items.
Laurenz suggested the migration section; cd838e200 isn't listed there
either, but I'm happy to move it if that's preferred.
The patch also fixes a doubled "the" in the collation entry of the
same section.
Peter, CC'ing you since it's your commit.
Regards,
Kacper Kuras=
Attachments:
relnotes-18-restrict-violation.diff (application/octet-stream, 1.4K) download
diff --git a/doc/src/sgml/release-18.sgml b/doc/src/sgml/release-18.sgml
index 7a7a51649ea..4e74fa94414 100644
--- a/doc/src/sgml/release-18.sgml
+++ b/doc/src/sgml/release-18.sgml
@@ -10744,7 +10744,7 @@ Author: Peter Eisentraut <peter@eisentraut.org>
<para>
Require <link
linkend="sql-createtable-parms-references">primary/foreign key</link>
- relationships to use either deterministic collations or the the
+ relationships to use either deterministic collations or the
same nondeterministic collations (Peter Eisentraut)
<ulink url="&commit_baseurl;9321d2fdf">§</ulink>
</para>
@@ -10849,6 +10849,24 @@ Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
</para>
</listitem>
+<!--
+Author: Peter Eisentraut <peter@eisentraut.org>
+2024-12-02 [086c84b23] Fix error code for referential action RESTRICT
+-->
+
+ <listitem>
+ <para>
+ Report <literal>RESTRICT</literal> <link
+ linkend="sql-createtable-parms-references">foreign key</link>
+ violations with <link
+ linkend="errcodes-appendix"><literal>SQLSTATE</literal></link>
+ <literal>23001</literal> (<literal>restrict_violation</literal>)
+ instead of <literal>23503</literal>
+ (<literal>foreign_key_violation</literal>) (Peter Eisentraut)
+ <ulink url="&commit_baseurl;086c84b23">§</ulink>
+ </para>
+ </listitem>
+
</itemizedlist>
</sect4>
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: E.6.3.2.1. Constraints
@ 2026-10-23 19:06 Bruce Momjian <bruce@momjian.us>
parent: Kacper Kuras <kacperkuras@hotmail.com>
0 siblings, 1 reply; 10+ messages in thread
From: Bruce Momjian @ 2026-10-23 19:06 UTC (permalink / raw)
To: Kacper Kuras <kacperkuras@hotmail.com>; +Cc: David Rowley <dgrowleyml@gmail.com>; Daniel Gustafsson <daniel@yesql.se>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>; Peter Eisentraut <peter@eisentraut.org>
On Sat, Oct 10, 2026 at 12:41:13PM +0000, Kacper Kuras wrote:
> Here is a patch for this case, against REL_18_STABLE, that adds
> 086c84b23 to the 18 release notes:
>
> Report RESTRICT foreign key violations with SQLSTATE 23001
> (restrict_violation) instead of 23503 (foreign_key_violation)
> (Peter Eisentraut)
>
> I put it in the Constraints section with the other foreign key items.
> Laurenz suggested the migration section; cd838e200 isn't listed there
> either, but I'm happy to move it if that's preferred.
>
> The patch also fixes a doubled "the" in the collation entry of the
> same section.
>
> Peter, CC'ing you since it's your commit.
Patch applied, though I moved it to the "incompatibilities" section,
where I felt it made more sense.
I am still unclear how I will catch such changes in the future without
requiring users to report them.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Do not let urgent matters crowd out time for investment in the future.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: E.6.3.2.1. Constraints
@ 2026-10-29 19:13 Kacper Kuras <kacperkuras@hotmail.com>
parent: Bruce Momjian <bruce@momjian.us>
0 siblings, 0 replies; 10+ messages in thread
From: Kacper Kuras @ 2026-10-29 19:13 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: David Rowley <dgrowleyml@gmail.com>; Daniel Gustafsson <daniel@yesql.se>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>; Peter Eisentraut <peter@eisentraut.org>
Thanks for applying it.
> I am still unclear how I will catch such changes in the future without
> requiring users to report them.
I tried to see whether a script could find these. It walks the
commits in a range and lists the ones where an existing error starts
reporting a different SQLSTATE: a file trading one ERRCODE_* for
another, an error that used to report XX000 getting a specific code
(or the reverse), or the first use of a code that errcodes.txt already
had, which is how 086c84b23 looks. On REL_17_0..REL_18_0 it lists 25
commits, including both SQLSTATE items in the 18 notes.
On REL_18_0..REL_19_RC1, these change the SQLSTATE of an existing error
and aren't in the 19 notes:
0836683a8 PL/pgSQL: a reserved word used as a record field name
now reports 42601 (syntax_error) instead of 42703
(undefined_column)
88a658a42 amcheck: a target that isn't an index, such as a
partitioned index, now reports 42809 (wrong_object_type),
and an invalid index reports 55000
(object_not_in_prerequisite_state); both used to report
0A000 (feature_not_supported)
There are also several where an error that used to report XX000 now
has a specific code, for example 4c5291435 for the pg_restore_*_stats()
functions.
I had an AI write the script; I checked its output against the PG 17
and PG 18 release notes and verified the PG 19 items above by hand.
It can't see codes passed in variables or errors that move to another
file, so it's a list to review rather than a guarantee. Tags in commit
messages, as David suggested, would still be the better source; this
is only meant to catch what slips through. I can post the script if
it's useful.
Regards,
Kacper Kuras
^ permalink raw reply [nested|flat] 10+ messages in thread
end of thread, other threads:[~2026-10-29 19:13 UTC | newest]
Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-19 14:49 E.6.3.2.1. Constraints PG Doc comments form <noreply@postgresql.org>
2026-09-21 19:08 ` Bruce Momjian <bruce@momjian.us>
2026-09-22 05:51 ` Laurenz Albe <laurenz.albe@cybertec.at>
2026-09-22 06:37 ` Daniel Gustafsson <daniel@yesql.se>
2026-09-22 13:40 ` Bruce Momjian <bruce@momjian.us>
2026-10-03 18:43 ` Kacper Kuras <kacperkuras@hotmail.com>
2026-10-05 01:40 ` David Rowley <dgrowleyml@gmail.com>
2026-10-10 12:41 ` Kacper Kuras <kacperkuras@hotmail.com>
2026-10-23 19:06 ` Bruce Momjian <bruce@momjian.us>
2026-10-29 19:13 ` Kacper Kuras <kacperkuras@hotmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox