]> granicus.if.org Git - postgresql/commit
Provide database object names as separate fields in error messages.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 29 Jan 2013 22:06:26 +0000 (17:06 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 29 Jan 2013 22:08:26 +0000 (17:08 -0500)
commit991f3e5ab3f8196d18d5b313c81a5f744f3baaea
tree376f7a4bc5541156a3c270304dc22333f2ba6955
parent89d00cbe01447fd36edbc3bed659f869b18172d1
Provide database object names as separate fields in error messages.

This patch addresses the problem that applications currently have to
extract object names from possibly-localized textual error messages,
if they want to know for example which index caused a UNIQUE_VIOLATION
failure.  It adds new error message fields to the wire protocol, which
can carry the name of a table, table column, data type, or constraint
associated with the error.  (Since the protocol spec has always instructed
clients to ignore unrecognized field types, this should not create any
compatibility problem.)

Support for providing these new fields has been added to just a limited set
of error reports (mainly, those in the "integrity constraint violation"
SQLSTATE class), but we will doubtless add them to more calls in future.

Pavel Stehule, reviewed and extensively revised by Peter Geoghegan, with
additional hacking by Tom Lane.
27 files changed:
doc/src/sgml/errcodes.sgml
doc/src/sgml/libpq.sgml
doc/src/sgml/protocol.sgml
doc/src/sgml/sources.sgml
src/backend/access/hash/hash.c
src/backend/access/hash/hashsort.c
src/backend/access/nbtree/nbtinsert.c
src/backend/access/nbtree/nbtree.c
src/backend/access/nbtree/nbtsort.c
src/backend/commands/tablecmds.c
src/backend/commands/typecmds.c
src/backend/executor/execMain.c
src/backend/executor/execQual.c
src/backend/executor/execUtils.c
src/backend/utils/adt/domains.c
src/backend/utils/adt/ri_triggers.c
src/backend/utils/cache/relcache.c
src/backend/utils/error/elog.c
src/backend/utils/sort/tuplesort.c
src/include/access/hash.h
src/include/access/nbtree.h
src/include/postgres_ext.h
src/include/utils/builtins.h
src/include/utils/elog.h
src/include/utils/relcache.h
src/include/utils/tuplesort.h
src/interfaces/libpq/fe-protocol3.c