mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-08 14:37:35 +08:00
This has been requested a few times, but the use-case for it was never entirely clear. The reason for adding it now is that transmission of error reports from parallel workers fails when NLS is active, because pq_parse_errornotice() wrongly assumes that the existing severity field is nonlocalized. There are other ways we could have fixed that, but the other options were basically kluges, whereas this way provides something that's at least arguably a useful feature along with the bug fix. Per report from Jakob Egger. Back-patch into 9.6, because otherwise parallel query is essentially unusable in non-English locales. The problem exists in 9.5 as well, but we don't want to risk changing on-the-wire behavior in 9.5 (even though the possibility of new error fields is specifically called out in the protocol document). It may be sufficient to leave the issue unfixed in 9.5, given the very limited usefulness of pq_parse_errornotice in that version. Discussion: <A88E0006-13CB-49C6-95CC-1A77D717213C@eggerapps.at>
71 lines
2.1 KiB
C
71 lines
2.1 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* postgres_ext.h
|
|
*
|
|
* This file contains declarations of things that are visible everywhere
|
|
* in PostgreSQL *and* are visible to clients of frontend interface libraries.
|
|
* For example, the Oid type is part of the API of libpq and other libraries.
|
|
*
|
|
* Declarations which are specific to a particular interface should
|
|
* go in the header file for that interface (such as libpq-fe.h). This
|
|
* file is only for fundamental Postgres declarations.
|
|
*
|
|
* User-written C functions don't count as "external to Postgres."
|
|
* Those function much as local modifications to the backend itself, and
|
|
* use header files that are otherwise internal to Postgres to interface
|
|
* with the backend.
|
|
*
|
|
* src/include/postgres_ext.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef POSTGRES_EXT_H
|
|
#define POSTGRES_EXT_H
|
|
|
|
#include "pg_config_ext.h"
|
|
|
|
/*
|
|
* Object ID is a fundamental type in Postgres.
|
|
*/
|
|
typedef unsigned int Oid;
|
|
|
|
#ifdef __cplusplus
|
|
#define InvalidOid (Oid(0))
|
|
#else
|
|
#define InvalidOid ((Oid) 0)
|
|
#endif
|
|
|
|
#define OID_MAX UINT_MAX
|
|
/* you will need to include <limits.h> to use the above #define */
|
|
|
|
/* Define a signed 64-bit integer type for use in client API declarations. */
|
|
typedef PG_INT64_TYPE pg_int64;
|
|
|
|
|
|
/*
|
|
* Identifiers of error message fields. Kept here to keep common
|
|
* between frontend and backend, and also to export them to libpq
|
|
* applications.
|
|
*/
|
|
#define PG_DIAG_SEVERITY 'S'
|
|
#define PG_DIAG_SEVERITY_NONLOCALIZED 'V'
|
|
#define PG_DIAG_SQLSTATE 'C'
|
|
#define PG_DIAG_MESSAGE_PRIMARY 'M'
|
|
#define PG_DIAG_MESSAGE_DETAIL 'D'
|
|
#define PG_DIAG_MESSAGE_HINT 'H'
|
|
#define PG_DIAG_STATEMENT_POSITION 'P'
|
|
#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'
|
|
|
|
#endif /* POSTGRES_EXT_H */
|