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

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

From
Tom Lane
Date:
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(-)