pgsql: When a row fails a CHECK constraint, show row's contents in errd

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: When a row fails a CHECK constraint, show row's contents in errd
Date: 2011-11-29 20:03:17
Message-ID: E1RVTtd-0002TE-FD@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

When a row fails a CHECK constraint, show row's contents in errdetail.

This should make it easier to identify which row is problematic when an
insert or update is processing many rows.

The formatting is similar to that for unique-index violation messages,
except that we limit field widths to 64 bytes since otherwise the message
could get unreasonably long. (In particular, there's currently no attempt
to quote or escape field values that contain commas etc.)

Jan Kundrát, reviewed by Royce Ausburn, somewhat rewritten by me.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/f1e13001b2ffff676b4b803db9ab439a1619dc4e

Modified Files
--------------
src/backend/executor/execMain.c | 66 +++++++++++++++++++++++++++-
src/test/regress/expected/alter_table.out | 9 ++++
src/test/regress/expected/domain.out | 2 +
src/test/regress/expected/inherit.out | 6 +++
src/test/regress/output/constraints.source | 20 ++++++++
5 files changed, 102 insertions(+), 1 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2011-11-29 21:32:40 pgsql: Suggest configure options for server developers.
Previous Message Peter Eisentraut 2011-11-29 20:02:20 Re: pgsql: pg_dump: Add gettext plural support to error message