diff options
author | Tom Lane | 2013-01-29 22:06:26 +0000 |
---|---|---|
committer | Tom Lane | 2013-01-29 22:08:26 +0000 |
commit | 991f3e5ab3f8196d18d5b313c81a5f744f3baaea (patch) | |
tree | 376f7a4bc5541156a3c270304dc22333f2ba6955 /src/include/postgres_ext.h | |
parent | 89d00cbe01447fd36edbc3bed659f869b18172d1 (diff) |
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/include/postgres_ext.h')
-rw-r--r-- | src/include/postgres_ext.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/include/postgres_ext.h b/src/include/postgres_ext.h index 5ba379f869b..48d5dd31e53 100644 --- a/src/include/postgres_ext.h +++ b/src/include/postgres_ext.h @@ -57,6 +57,11 @@ typedef PG_INT64_TYPE pg_int64; #define PG_DIAG_INTERNAL_POSITION 'p' #define PG_DIAG_INTERNAL_QUERY 'q' #define PG_DIAG_CONTEXT 'W' +#define PG_DIAG_SCHEMA_NAME 's' +#define PG_DIAG_TABLE_NAME 't' +#define PG_DIAG_COLUMN_NAME 'c' +#define PG_DIAG_DATATYPE_NAME 'd' +#define PG_DIAG_CONSTRAINT_NAME 'n' #define PG_DIAG_SOURCE_FILE 'F' #define PG_DIAG_SOURCE_LINE 'L' #define PG_DIAG_SOURCE_FUNCTION 'R' |