PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
postgres_ext.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * postgres_ext.h
4 *
5 * This file contains declarations of things that are visible everywhere
6 * in PostgreSQL *and* are visible to clients of frontend interface libraries.
7 * For example, the Oid type is part of the API of libpq and other libraries.
8 *
9 * Declarations which are specific to a particular interface should
10 * go in the header file for that interface (such as libpq-fe.h). This
11 * file is only for fundamental Postgres declarations.
12 *
13 * User-written C functions don't count as "external to Postgres."
14 * Those function much as local modifications to the backend itself, and
15 * use header files that are otherwise internal to Postgres to interface
16 * with the backend.
17 *
18 * src/include/postgres_ext.h
19 *
20 *-------------------------------------------------------------------------
21 */
22/* IWYU pragma: always_keep */
23
24#ifndef POSTGRES_EXT_H
25#define POSTGRES_EXT_H
26
27/*
28 * Object ID is a fundamental type in Postgres.
29 */
30typedef unsigned int Oid;
31
32#ifdef __cplusplus
33#define InvalidOid (Oid(0))
34#else
35#define InvalidOid ((Oid) 0)
36#endif
37
38#define OID_MAX UINT_MAX
39/* you will need to include <limits.h> to use the above #define */
40
41#define atooid(x) ((Oid) strtoul((x), NULL, 10))
42/* the above needs <stdlib.h> */
43
44
45/*
46 * Identifiers of error message fields. Kept here to keep common
47 * between frontend and backend, and also to export them to libpq
48 * applications.
49 */
50#define PG_DIAG_SEVERITY 'S'
51#define PG_DIAG_SEVERITY_NONLOCALIZED 'V'
52#define PG_DIAG_SQLSTATE 'C'
53#define PG_DIAG_MESSAGE_PRIMARY 'M'
54#define PG_DIAG_MESSAGE_DETAIL 'D'
55#define PG_DIAG_MESSAGE_HINT 'H'
56#define PG_DIAG_STATEMENT_POSITION 'P'
57#define PG_DIAG_INTERNAL_POSITION 'p'
58#define PG_DIAG_INTERNAL_QUERY 'q'
59#define PG_DIAG_CONTEXT 'W'
60#define PG_DIAG_SCHEMA_NAME 's'
61#define PG_DIAG_TABLE_NAME 't'
62#define PG_DIAG_COLUMN_NAME 'c'
63#define PG_DIAG_DATATYPE_NAME 'd'
64#define PG_DIAG_CONSTRAINT_NAME 'n'
65#define PG_DIAG_SOURCE_FILE 'F'
66#define PG_DIAG_SOURCE_LINE 'L'
67#define PG_DIAG_SOURCE_FUNCTION 'R'
68
69#endif /* POSTGRES_EXT_H */
unsigned int Oid
Definition: postgres_ext.h:30