1996-10-31 07:10:14 +00:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* postgres.h--
|
1997-09-07 05:04:48 +00:00
|
|
|
* definition of (and support for) postgres system types.
|
1996-10-31 07:10:14 +00:00
|
|
|
* this file is included by almost every .c in the system
|
|
|
|
*
|
|
|
|
* Copyright (c) 1995, Regents of the University of California
|
|
|
|
*
|
1998-09-01 04:40:42 +00:00
|
|
|
* $Id: postgres.h,v 1.19 1998/09/01 04:34:01 momjian Exp $
|
1996-10-31 07:10:14 +00:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
/*
|
1997-09-07 05:04:48 +00:00
|
|
|
* NOTES
|
|
|
|
* this file will eventually contain the definitions for the
|
|
|
|
* following (and perhaps other) system types:
|
1996-10-31 07:10:14 +00:00
|
|
|
*
|
1997-09-07 05:04:48 +00:00
|
|
|
* int2 int4 float4 float8
|
|
|
|
* Oid regproc RegProcedure
|
|
|
|
* aclitem
|
|
|
|
* struct varlena
|
1998-04-26 04:12:15 +00:00
|
|
|
* int28 oid8
|
1997-09-07 05:04:48 +00:00
|
|
|
* bytea text
|
|
|
|
* NameData Name
|
1996-10-31 07:10:14 +00:00
|
|
|
*
|
1997-09-07 05:04:48 +00:00
|
|
|
* TABLE OF CONTENTS
|
|
|
|
* 1) simple type definitions
|
|
|
|
* 2) varlena and array types
|
|
|
|
* 3) TransactionId and CommandId
|
|
|
|
* 4) genbki macros used by catalog/pg_xxx.h files
|
|
|
|
* 5) random CSIGNBIT, MAXPGPATH, STATUS macros
|
1996-10-31 07:10:14 +00:00
|
|
|
*
|
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef POSTGRES_H
|
|
|
|
#define POSTGRES_H
|
|
|
|
|
1996-12-10 07:03:43 +00:00
|
|
|
#include "postgres_ext.h"
|
1998-07-03 04:24:16 +00:00
|
|
|
#ifndef WIN32
|
1996-10-31 07:10:14 +00:00
|
|
|
#include "config.h"
|
1998-07-03 04:24:16 +00:00
|
|
|
#endif
|
1996-10-31 07:10:14 +00:00
|
|
|
#include "c.h"
|
|
|
|
#include "utils/elog.h"
|
1996-11-04 06:35:36 +00:00
|
|
|
#include "utils/palloc.h"
|
1996-10-31 07:10:14 +00:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 05:04:48 +00:00
|
|
|
* Section 1: simple type definitions
|
1996-10-31 07:10:14 +00:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
1997-09-08 02:41:22 +00:00
|
|
|
typedef int16 int2;
|
|
|
|
typedef int32 int4;
|
|
|
|
typedef float float4;
|
|
|
|
typedef double float8;
|
1996-10-31 07:10:14 +00:00
|
|
|
|
1997-09-08 02:41:22 +00:00
|
|
|
typedef int4 aclitem;
|
1996-10-31 07:10:14 +00:00
|
|
|
|
1997-09-07 05:04:48 +00:00
|
|
|
#define InvalidOid 0
|
1996-10-31 07:10:14 +00:00
|
|
|
#define OidIsValid(objectId) ((bool) (objectId != InvalidOid))
|
|
|
|
|
|
|
|
/* unfortunately, both regproc and RegProcedure are used */
|
1997-09-08 02:41:22 +00:00
|
|
|
typedef Oid regproc;
|
|
|
|
typedef Oid RegProcedure;
|
1996-10-31 07:10:14 +00:00
|
|
|
|
|
|
|
/* ptr to func returning (char *) */
|
1997-09-08 02:41:22 +00:00
|
|
|
typedef char *((*func_ptr) ());
|
1996-10-31 07:10:14 +00:00
|
|
|
|
|
|
|
|
1997-09-07 05:04:48 +00:00
|
|
|
#define RegProcedureIsValid(p) OidIsValid(p)
|
1996-10-31 07:10:14 +00:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 05:04:48 +00:00
|
|
|
* Section 2: variable length and array types
|
1996-10-31 07:10:14 +00:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
/* ----------------
|
1997-09-07 05:04:48 +00:00
|
|
|
* struct varlena
|
1996-10-31 07:10:14 +00:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 05:04:48 +00:00
|
|
|
struct varlena
|
|
|
|
{
|
1997-09-08 02:41:22 +00:00
|
|
|
int32 vl_len;
|
|
|
|
char vl_dat[1];
|
1996-10-31 07:10:14 +00:00
|
|
|
};
|
|
|
|
|
1997-09-07 05:04:48 +00:00
|
|
|
#define VARSIZE(PTR) (((struct varlena *)(PTR))->vl_len)
|
|
|
|
#define VARDATA(PTR) (((struct varlena *)(PTR))->vl_dat)
|
|
|
|
#define VARHDRSZ sizeof(int32)
|
1996-10-31 07:10:14 +00:00
|
|
|
|
|
|
|
typedef struct varlena bytea;
|
|
|
|
typedef struct varlena text;
|
|
|
|
|
1997-09-08 02:41:22 +00:00
|
|
|
typedef int2 int28[8];
|
|
|
|
typedef Oid oid8[8];
|
1996-10-31 07:10:14 +00:00
|
|
|
|
1997-09-07 05:04:48 +00:00
|
|
|
typedef struct nameData
|
|
|
|
{
|
1997-09-08 02:41:22 +00:00
|
|
|
char data[NAMEDATALEN];
|
1997-09-08 21:56:23 +00:00
|
|
|
} NameData;
|
1997-09-07 05:04:48 +00:00
|
|
|
typedef NameData *Name;
|
1996-10-31 07:10:14 +00:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 05:04:48 +00:00
|
|
|
* Section 3: TransactionId and CommandId
|
1996-10-31 07:10:14 +00:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
1997-09-08 02:41:22 +00:00
|
|
|
typedef uint32 TransactionId;
|
1997-09-07 05:04:48 +00:00
|
|
|
|
1996-10-31 07:10:14 +00:00
|
|
|
#define InvalidTransactionId 0
|
1997-11-02 15:27:14 +00:00
|
|
|
typedef uint32 CommandId;
|
1997-09-07 05:04:48 +00:00
|
|
|
|
1996-10-31 07:10:14 +00:00
|
|
|
#define FirstCommandId 0
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 05:04:48 +00:00
|
|
|
* Section 4: genbki macros used by the
|
|
|
|
* catalog/pg_xxx.h files
|
1996-10-31 07:10:14 +00:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#define CATALOG(x) \
|
1997-09-07 05:04:48 +00:00
|
|
|
typedef struct CppConcat(FormData_,x)
|
1996-10-31 07:10:14 +00:00
|
|
|
|
|
|
|
#define DATA(x) extern int errno
|
1997-11-13 03:23:18 +00:00
|
|
|
#define DESCR(x) extern int errno
|
1996-10-31 07:10:14 +00:00
|
|
|
#define DECLARE_INDEX(x) extern int errno
|
|
|
|
|
|
|
|
#define BUILD_INDICES
|
|
|
|
#define BOOTSTRAP
|
|
|
|
|
|
|
|
#define BKI_BEGIN
|
|
|
|
#define BKI_END
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 05:04:48 +00:00
|
|
|
* Section 5: random stuff
|
|
|
|
* CSIGNBIT, MAXPGPATH, STATUS...
|
1996-10-31 07:10:14 +00:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* msb for int/unsigned */
|
1997-09-07 05:04:48 +00:00
|
|
|
#define ISIGNBIT (0x80000000)
|
|
|
|
#define WSIGNBIT (0x8000)
|
1996-10-31 07:10:14 +00:00
|
|
|
|
|
|
|
/* msb for char */
|
1997-09-07 05:04:48 +00:00
|
|
|
#define CSIGNBIT (0x80)
|
1996-10-31 07:10:14 +00:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 05:04:48 +00:00
|
|
|
* global variables which should probably go someplace else.
|
1996-10-31 07:10:14 +00:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 05:04:48 +00:00
|
|
|
#define MAXPGPATH 128
|
|
|
|
|
|
|
|
#define STATUS_OK (0)
|
|
|
|
#define STATUS_ERROR (-1)
|
|
|
|
#define STATUS_NOT_FOUND (-2)
|
|
|
|
#define STATUS_INVALID (-3)
|
|
|
|
#define STATUS_UNCATALOGUED (-4)
|
|
|
|
#define STATUS_REPLACED (-5)
|
|
|
|
#define STATUS_NOT_DONE (-6)
|
|
|
|
#define STATUS_BAD_PACKET (-7)
|
|
|
|
#define STATUS_FOUND (1)
|
|
|
|
|
1998-02-24 15:27:04 +00:00
|
|
|
/* ---------------
|
|
|
|
* Cyrillic on the fly charsets recode
|
|
|
|
* ---------------
|
|
|
|
*/
|
|
|
|
#ifdef CYR_RECODE
|
1998-02-26 04:46:47 +00:00
|
|
|
void SetCharSet();
|
|
|
|
|
1998-09-01 04:40:42 +00:00
|
|
|
#endif /* CYR_RECODE */
|
1998-02-24 15:27:04 +00:00
|
|
|
|
1998-09-01 04:40:42 +00:00
|
|
|
#endif /* POSTGRES_H */
|