1996-08-27 23:50:29 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* tupdesc.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* POSTGRES tuple descriptor definitions.
|
1996-08-27 23:50:29 +02:00
|
|
|
*
|
|
|
|
*
|
2002-06-20 22:29:54 +02:00
|
|
|
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-08-27 23:50:29 +02:00
|
|
|
*
|
2002-09-04 22:31:48 +02:00
|
|
|
* $Id: tupdesc.h,v 1.39 2002/09/04 20:31:37 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
|
|
|
|
|
1999-07-16 01:04:24 +02:00
|
|
|
#include "access/attnum.h"
|
|
|
|
#include "catalog/pg_attribute.h"
|
1999-07-16 19:07:40 +02:00
|
|
|
#include "nodes/pg_list.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;
|
1999-10-04 01:55:40 +02:00
|
|
|
char *adbin; /* nodeToString representation of expr */
|
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;
|
1999-10-04 01:55:40 +02:00
|
|
|
char *ccbin; /* nodeToString representation of expr */
|
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
|
|
|
|
{
|
1999-10-04 01:55:40 +02:00
|
|
|
AttrDefault *defval; /* array */
|
|
|
|
ConstrCheck *check; /* array */
|
1997-09-08 04:41:22 +02:00
|
|
|
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
|
2002-09-02 03:05:06 +02:00
|
|
|
* pg_attribute, pg_attrdef, pg_constraint) for the structure of a tuple.
|
1997-08-21 06:10:25 +02:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct tupleDesc
|
|
|
|
{
|
2000-01-31 05:35:57 +01:00
|
|
|
int natts; /* Number of attributes in the tuple */
|
1998-09-01 05:29:17 +02:00
|
|
|
Form_pg_attribute *attrs;
|
1997-09-07 07:04:48 +02:00
|
|
|
/* attrs[N] is a pointer to the description of Attribute Number N+1. */
|
1997-09-08 04:41:22 +02:00
|
|
|
TupleConstr *constr;
|
2002-09-02 03:05:06 +02:00
|
|
|
bool tdhasoid; /* Tuple has oid attribute in its header */
|
2001-11-05 18:46:40 +01:00
|
|
|
} *TupleDesc;
|
1996-08-27 23:50:29 +02:00
|
|
|
|
2002-07-20 07:16:59 +02:00
|
|
|
|
2002-09-02 03:05:06 +02:00
|
|
|
extern TupleDesc CreateTemplateTupleDesc(int natts, bool hasoid);
|
2002-07-20 07:16:59 +02:00
|
|
|
|
2002-09-02 03:05:06 +02:00
|
|
|
extern TupleDesc CreateTupleDesc(int natts, bool hasoid,
|
2002-09-04 22:31:48 +02:00
|
|
|
Form_pg_attribute *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
|
|
|
|
2000-01-31 05:35:57 +01:00
|
|
|
extern bool equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2);
|
|
|
|
|
2002-03-29 20:06:29 +01:00
|
|
|
extern void TupleDescInitEntry(TupleDesc desc,
|
1997-09-07 07:04:48 +02:00
|
|
|
AttrNumber attributeNumber,
|
|
|
|
char *attributeName,
|
2000-05-22 04:34:23 +02:00
|
|
|
Oid oidtypeid,
|
1998-07-12 23:29:40 +02:00
|
|
|
int32 typmod,
|
1997-09-07 07:04:48 +02:00
|
|
|
int attdim,
|
|
|
|
bool attisset);
|
1996-08-27 23:50:29 +02:00
|
|
|
|
2002-03-29 20:06:29 +01:00
|
|
|
extern TupleDesc BuildDescForRelation(List *schema);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* TUPDESC_H */
|