1 /*-------------------------------------------------------------------------
4 * definition of (and support for) postgres system types.
5 * this file is included by almost every .c in the system
7 * Copyright (c) 1995, Regents of the University of California
9 * $Id: postgres.h,v 1.22 1999/05/03 19:10:14 momjian Exp $
11 *-------------------------------------------------------------------------
15 * this file will eventually contain the definitions for the
16 * following (and perhaps other) system types:
18 * int2 int4 float4 float8
19 * Oid regproc RegProcedure
27 * 1) simple type definitions
28 * 2) varlena and array types
29 * 3) TransactionId and CommandId
30 * 4) genbki macros used by catalog/pg_xxx.h files
31 * 5) random CSIGNBIT, MAXPGPATH, STATUS macros
33 * ----------------------------------------------------------------
38 #include "postgres_ext.h"
43 #include "utils/elog.h"
44 #include "utils/palloc.h"
46 /* ----------------------------------------------------------------
47 * Section 1: simple type definitions
48 * ----------------------------------------------------------------
54 typedef double float8;
59 #define OidIsValid(objectId) ((bool) (objectId != InvalidOid))
61 /* unfortunately, both regproc and RegProcedure are used */
63 typedef Oid RegProcedure;
65 /* ptr to func returning (char *) */
66 typedef char *((*func_ptr) ());
69 #define RegProcedureIsValid(p) OidIsValid(p)
71 /* ----------------------------------------------------------------
72 * Section 2: variable length and array types
73 * ----------------------------------------------------------------
85 #define VARSIZE(PTR) (((struct varlena *)(PTR))->vl_len)
86 #define VARDATA(PTR) (((struct varlena *)(PTR))->vl_dat)
87 #define VARHDRSZ sizeof(int32)
89 typedef struct varlena bytea;
90 typedef struct varlena text;
92 typedef int2 int28[8];
95 /* We want NameData to have length NAMEDATALEN and int alignment,
96 * because that's how the data type 'name' is defined in pg_type.
97 * Use a union to make sure the compiler agrees.
99 typedef union nameData
101 char data[NAMEDATALEN];
104 typedef NameData *Name;
106 /* ----------------------------------------------------------------
107 * Section 3: TransactionId and CommandId
108 * ----------------------------------------------------------------
111 typedef uint32 TransactionId;
113 #define InvalidTransactionId 0
114 typedef uint32 CommandId;
116 #define FirstCommandId 0
118 /* ----------------------------------------------------------------
119 * Section 4: genbki macros used by the
120 * catalog/pg_xxx.h files
121 * ----------------------------------------------------------------
124 typedef struct CppConcat(FormData_,x)
126 #define DATA(x) extern int errno
127 #define DESCR(x) extern int errno
128 #define DECLARE_INDEX(x) extern int errno
130 #define BUILD_INDICES
136 /* ----------------------------------------------------------------
137 * Section 5: random stuff
138 * CSIGNBIT, MAXPGPATH, STATUS...
139 * ----------------------------------------------------------------
142 /* msb for int/unsigned */
143 #define ISIGNBIT (0x80000000)
144 #define WSIGNBIT (0x8000)
147 #define CSIGNBIT (0x80)
150 * global variables which should probably go someplace else.
153 #define MAXPGPATH 128
154 #define MAX_QUERY_SIZE (BLCKSZ*2)
156 #define STATUS_OK (0)
157 #define STATUS_ERROR (-1)
158 #define STATUS_NOT_FOUND (-2)
159 #define STATUS_INVALID (-3)
160 #define STATUS_UNCATALOGUED (-4)
161 #define STATUS_REPLACED (-5)
162 #define STATUS_NOT_DONE (-6)
163 #define STATUS_BAD_PACKET (-7)
164 #define STATUS_FOUND (1)
167 * Cyrillic on the fly charsets recode
173 #endif /* CYR_RECODE */
175 #endif /* POSTGRES_H */