pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Assign error codes where missing for user-facing failures
Date: Thu, 04 Jul 2024 00:50:15 +0000
Message-ID: <E1sPAft-000Dpr-To@gemulon.postgresql.org> (raw)

Assign error codes where missing for user-facing failures

All the errors triggered in the code paths patched here would cause the
backend to issue an internal_error errcode, which is a state that should
be used only for "can't happen" situations.  However, these code paths
are reachable by the regression tests, and could be seen by users in
valid cases.  Some regression tests expect internal errcodes as they
manipulate the backend state to cause corruption (like checksums), or
use elog() because it is more convenient (like injection points), these
have no need to change.

This reduces the number of internal failures triggered in a check-world
by more than half, while providing correct errcodes for these valid
cases.

Reviewed-by: Robert Haas
Discussion: https://postgr.es/m/Zic_GNgos5sMxKoa@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b81a71aa05f294705e1b1d4fe24548f175f9bfe9

Modified Files
--------------
contrib/pg_walinspect/pg_walinspect.c     |  3 ++-
src/backend/access/transam/xlogrecovery.c |  3 ++-
src/backend/backup/basebackup.c           |  6 ++++--
src/backend/commands/matview.c            |  4 +++-
src/backend/commands/tablecmds.c          |  3 ++-
src/backend/commands/trigger.c            |  1 +
src/backend/commands/user.c               |  2 ++
src/backend/libpq/be-secure-openssl.c     |  3 ++-
src/backend/optimizer/util/appendinfo.c   | 12 ++++++++----
src/backend/replication/slotfuncs.c       |  3 ++-
src/backend/utils/adt/pg_locale.c         | 21 ++++++++++++++-------
src/backend/utils/adt/tid.c               | 24 +++++++++++++++++-------
12 files changed, 59 insertions(+), 26 deletions(-)



Message-ID: <E1sPAft-000Dpr-To@gemulon.postgresql.org>
Permalink:  ../E1sPAft-000Dpr-To@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sPAft-000Dpr-To@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Assign error codes where missing for user-facing failures
  In-Reply-To: <E1sPAft-000Dpr-To@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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