diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2013-01-29 17:06:26 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2013-01-29 17:08:26 -0500 |
commit | 991f3e5ab3f8196d18d5b313c81a5f744f3baaea (patch) | |
tree | 376f7a4bc5541156a3c270304dc22333f2ba6955 /src/backend/access/nbtree/nbtree.c | |
parent | 89d00cbe01447fd36edbc3bed659f869b18172d1 (diff) | |
download | postgresql-991f3e5ab3f8196d18d5b313c81a5f744f3baaea.tar.gz postgresql-991f3e5ab3f8196d18d5b313c81a5f744f3baaea.zip |
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.
Diffstat (limited to 'src/backend/access/nbtree/nbtree.c')
-rw-r--r-- | src/backend/access/nbtree/nbtree.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c index 159b57fcd1f..0e041683652 100644 --- a/src/backend/access/nbtree/nbtree.c +++ b/src/backend/access/nbtree/nbtree.c @@ -109,14 +109,14 @@ btbuild(PG_FUNCTION_ARGS) elog(ERROR, "index \"%s\" already contains data", RelationGetRelationName(index)); - buildstate.spool = _bt_spoolinit(index, indexInfo->ii_Unique, false); + buildstate.spool = _bt_spoolinit(heap, index, indexInfo->ii_Unique, false); /* * If building a unique index, put dead tuples in a second spool to keep * them out of the uniqueness check. */ if (indexInfo->ii_Unique) - buildstate.spool2 = _bt_spoolinit(index, false, true); + buildstate.spool2 = _bt_spoolinit(heap, index, false, true); /* do the heap scan */ reltuples = IndexBuildHeapScan(heap, index, indexInfo, true, |