postgres_ext.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. #ifndef POSTGRES_EXT_H
  23. #define POSTGRES_EXT_H
  24. #include "pg_config_ext.h"
  25. /*
  26. * Object ID is a fundamental type in Postgres.
  27. */
  28. typedef unsigned int Oid;
  29. #ifdef __cplusplus
  30. #define InvalidOid (Oid(0))
  31. #else
  32. #define InvalidOid ((Oid) 0)
  33. #endif
  34. #define OID_MAX UINT_MAX
  35. /* you will need to include <limits.h> to use the above #define */
  36. /* Define a signed 64-bit integer type for use in client API declarations. */
  37. typedef PG_INT64_TYPE pg_int64;
  38. /*
  39. * Identifiers of error message fields. Kept here to keep common
  40. * between frontend and backend, and also to export them to libpq
  41. * applications.
  42. */
  43. #define PG_DIAG_SEVERITY 'S'
  44. #define PG_DIAG_SEVERITY_NONLOCALIZED 'V'
  45. #define PG_DIAG_SQLSTATE 'C'
  46. #define PG_DIAG_MESSAGE_PRIMARY 'M'
  47. #define PG_DIAG_MESSAGE_DETAIL 'D'
  48. #define PG_DIAG_MESSAGE_HINT 'H'
  49. #define PG_DIAG_STATEMENT_POSITION 'P'
  50. #define PG_DIAG_INTERNAL_POSITION 'p'
  51. #define PG_DIAG_INTERNAL_QUERY 'q'
  52. #define PG_DIAG_CONTEXT 'W'
  53. #define PG_DIAG_SCHEMA_NAME 's'
  54. #define PG_DIAG_TABLE_NAME 't'
  55. #define PG_DIAG_COLUMN_NAME 'c'
  56. #define PG_DIAG_DATATYPE_NAME 'd'
  57. #define PG_DIAG_CONSTRAINT_NAME 'n'
  58. #define PG_DIAG_SOURCE_FILE 'F'
  59. #define PG_DIAG_SOURCE_LINE 'L'
  60. #define PG_DIAG_SOURCE_FUNCTION 'R'
  61. #endif /* POSTGRES_EXT_H */