codekingpro/portable-devtools
115k
1/*-------------------------------------------------------------------------2 *3 * postgres_ext.h4 *5 * This file contains declarations of things that are visible everywhere6 * 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 should10 * go in the header file for that interface (such as libpq-fe.h). This11 * 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, and15 * use header files that are otherwise internal to Postgres to interface16 * with the backend.17 *18 * src/include/postgres_ext.h19 *20 *-------------------------------------------------------------------------21 */22 23#ifndef POSTGRES_EXT_H24#define POSTGRES_EXT_H25 26#include "pg_config_ext.h"27 28/*29 * Object ID is a fundamental type in Postgres.30 */31typedef unsigned int Oid;32 33#ifdef __cplusplus34#define InvalidOid (Oid(0))35#else36#define InvalidOid ((Oid) 0)37#endif38 39#define OID_MAX UINT_MAX40/* you will need to include <limits.h> to use the above #define */41 42#define atooid(x) ((Oid) strtoul((x), NULL, 10))43/* the above needs <stdlib.h> */44 45 46/* Define a signed 64-bit integer type for use in client API declarations. */47typedef PG_INT64_TYPE pg_int64;48 49/*50 * Identifiers of error message fields. Kept here to keep common51 * between frontend and backend, and also to export them to libpq52 * applications.53 */54#define PG_DIAG_SEVERITY 'S'55#define PG_DIAG_SEVERITY_NONLOCALIZED 'V'56#define PG_DIAG_SQLSTATE 'C'57#define PG_DIAG_MESSAGE_PRIMARY 'M'58#define PG_DIAG_MESSAGE_DETAIL 'D'59#define PG_DIAG_MESSAGE_HINT 'H'60#define PG_DIAG_STATEMENT_POSITION 'P'61#define PG_DIAG_INTERNAL_POSITION 'p'62#define PG_DIAG_INTERNAL_QUERY 'q'63#define PG_DIAG_CONTEXT 'W'64#define PG_DIAG_SCHEMA_NAME 's'65#define PG_DIAG_TABLE_NAME 't'66#define PG_DIAG_COLUMN_NAME 'c'67#define PG_DIAG_DATATYPE_NAME 'd'68#define PG_DIAG_CONSTRAINT_NAME 'n'69#define PG_DIAG_SOURCE_FILE 'F'70#define PG_DIAG_SOURCE_LINE 'L'71#define PG_DIAG_SOURCE_FUNCTION 'R'72 73#endif /* POSTGRES_EXT_H */74 