1996-08-27 23:50:29 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* tupdesc.h--
|
1997-09-07 07:04:48 +02:00
|
|
|
* POSTGRES tuple descriptor definitions.
|
1996-08-27 23:50:29 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
1998-02-26 05:46:47 +01:00
|
|
|
* $Id: tupdesc.h,v 1.16 1998/02/26 04:40:31 momjian Exp $
|
1996-08-27 23:50:29 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#ifndef TUPDESC_H
|
1996-08-27 23:50:29 +02:00
|
|
|
#define TUPDESC_H
|
|
|
|
|
1996-11-04 08:46:06 +01:00
|
|
|
#include <nodes/pg_list.h>
|
|
|
|
#include <access/attnum.h>
|
|
|
|
#include <catalog/pg_attribute.h>
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-08-19 06:46:15 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct attrDefault
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
AttrNumber adnum;
|
|
|
|
char *adbin;
|
|
|
|
char *adsrc;
|
1997-09-08 22:59:27 +02:00
|
|
|
} AttrDefault;
|
1997-08-21 06:10:25 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct constrCheck
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
char *ccname;
|
|
|
|
char *ccbin;
|
|
|
|
char *ccsrc;
|
1997-09-08 23:56:23 +02:00
|
|
|
} ConstrCheck;
|
1997-08-21 06:10:25 +02:00
|
|
|
|
|
|
|
/* This structure contains constraints of a tuple */
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct tupleConstr
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
AttrDefault *defval;
|
|
|
|
ConstrCheck *check;
|
|
|
|
uint16 num_defval;
|
|
|
|
uint16 num_check;
|
|
|
|
bool has_not_null;
|
1997-09-08 23:56:23 +02:00
|
|
|
} TupleConstr;
|
1997-08-21 06:10:25 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This structure contains all information (i.e. from Classes
|
1997-09-07 07:04:48 +02:00
|
|
|
* pg_attribute, pg_attrdef, pg_relcheck) for a tuple.
|
1997-08-21 06:10:25 +02:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct tupleDesc
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
int natts;
|
1997-09-07 07:04:48 +02:00
|
|
|
/* Number of attributes in the tuple */
|
|
|
|
AttributeTupleForm *attrs;
|
|
|
|
/* attrs[N] is a pointer to the description of Attribute Number N+1. */
|
1997-09-08 04:41:22 +02:00
|
|
|
TupleConstr *constr;
|
|
|
|
} *TupleDesc;
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
extern TupleDesc CreateTemplateTupleDesc(int natts);
|
|
|
|
|
1997-09-08 22:59:27 +02:00
|
|
|
extern TupleDesc CreateTupleDesc(int natts, AttributeTupleForm *attrs);
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
extern TupleDesc CreateTupleDescCopy(TupleDesc tupdesc);
|
|
|
|
|
1997-08-22 05:55:39 +02:00
|
|
|
extern TupleDesc CreateTupleDescCopyConstr(TupleDesc tupdesc);
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
extern void FreeTupleDesc(TupleDesc tupdesc);
|
1997-08-22 05:55:39 +02:00
|
|
|
|
1998-02-26 05:46:47 +01:00
|
|
|
extern bool
|
|
|
|
TupleDescInitEntry(TupleDesc desc,
|
1997-09-07 07:04:48 +02:00
|
|
|
AttrNumber attributeNumber,
|
|
|
|
char *attributeName,
|
1998-02-10 05:02:59 +01:00
|
|
|
Oid typeid,
|
1998-02-10 17:04:38 +01:00
|
|
|
int16 typmod,
|
1997-09-07 07:04:48 +02:00
|
|
|
int attdim,
|
|
|
|
bool attisset);
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-08 23:56:23 +02:00
|
|
|
extern TupleDesc BuildDescForRelation(List *schema, char *relname);
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#endif /* TUPDESC_H */
|