mirror of
https://github.com/postgres/postgres.git
synced 2025-10-29 22:49:41 +03:00
Previously we used pg_int64 in three function prototypes in libpq. It was added by commit461ef73fto expose the platform-dependent type used for int64 in the C89 era. As of commit962da900it is defined as standard int64_t, and the dust seems to have settled. Let's just use int64_t directly in these three client-facing functions instead of (yet) another name. We've required C99 and thus <stdint.h> since PostgreSQL 12, C89 and C++98 compilers are long gone, and client applications very likely use standard types for their own 64-bit needs. This also cleans up the obscure placement of a new #include <stdint.h> directive in postgres_ext.h, required for the new definition. The typedef was hiding in there for historical reasons, but it doesn't fit postgres_ext.h's own description of its purpose and there is no evidence of client applications including postgres_ext.h directly to see it. Keep a typedef marked deprecated for backward compatibility, but move it into libpq-fe.h where it was used. Reviewed-by: Peter Eisentraut <peter@eisentraut.org> Discussion: https://postgr.es/m/CA%2BhUKGKn_EkNNGMY5RzMcKP%2Ba6urT4JF%3DCPhw_zHtQwjvX6P2g%40mail.gmail.com
70 lines
2.1 KiB
C
70 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
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
/* IWYU pragma: always_keep */
|
|
|
|
#ifndef POSTGRES_EXT_H
|
|
#define POSTGRES_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 atooid(x) ((Oid) strtoul((x), NULL, 10))
|
|
/* the above needs <stdlib.h> */
|
|
|
|
|
|
/*
|
|
* 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 */
|