Commit cc332d61 authored by Vadim B. Mikheev's avatar Vadim B. Mikheev

AttrConstr --> TupleConstr

parent e4824629
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.16 1997/08/21 03:01:15 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.17 1997/08/21 04:03:34 vadim Exp $
* *
* NOTES * NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be * some of the executor utility code such as "ExecTypeFromTL" should be
...@@ -119,8 +119,8 @@ CreateTupleDescCopy(TupleDesc tupdesc) ...@@ -119,8 +119,8 @@ CreateTupleDescCopy(TupleDesc tupdesc)
ATTRIBUTE_TUPLE_SIZE); ATTRIBUTE_TUPLE_SIZE);
} }
if (tupdesc->constr) { if (tupdesc->constr) {
desc->constr = (AttrConstr *) palloc(sizeof(struct attrConstr)); desc->constr = (TupleConstr *) palloc(sizeof(TupleConstr));
memmove(desc->constr, tupdesc->constr, sizeof(struct attrConstr)); memmove(desc->constr, tupdesc->constr, sizeof(TupleConstr));
} else } else
desc->constr = NULL; desc->constr = NULL;
return desc; return desc;
...@@ -179,7 +179,7 @@ TupleDescInitEntry(TupleDesc desc, ...@@ -179,7 +179,7 @@ TupleDescInitEntry(TupleDesc desc,
memset(att->attname.data,0,NAMEDATALEN); memset(att->attname.data,0,NAMEDATALEN);
att->attdisbursion = 0; /* dummy value */ att->attnvals = 0; /* dummy value */
att->attcacheoff = -1; att->attcacheoff = -1;
att->attnum = attributeNumber; att->attnum = attributeNumber;
...@@ -387,7 +387,7 @@ BuildDescForRelation(List *schema, char *relname) ...@@ -387,7 +387,7 @@ BuildDescForRelation(List *schema, char *relname)
/* This is for constraints */ /* This is for constraints */
if (entry->is_not_null) { if (entry->is_not_null) {
if (!desc->constr) if (!desc->constr)
desc->constr = (AttrConstr *) palloc(sizeof(struct attrConstr)); desc->constr = (TupleConstr *) palloc(sizeof(TupleConstr));
desc->constr->has_not_null = true; desc->constr->has_not_null = true;
} }
desc->attrs[attnum-1]->attnotnull = entry->is_not_null; desc->attrs[attnum-1]->attnotnull = entry->is_not_null;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.12 1997/08/19 04:43:30 vadim Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.13 1997/08/21 04:05:22 vadim Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -276,7 +276,7 @@ MergeAttributes(List *schema, List *supers) ...@@ -276,7 +276,7 @@ MergeAttributes(List *schema, List *supers)
AttributeTupleForm attribute = tupleDesc->attrs[attrno]; AttributeTupleForm attribute = tupleDesc->attrs[attrno];
char *attributeName; char *attributeName;
char *attributeType; char *attributeType;
AttrConstr constraints; TupleConstr constraints;
HeapTuple tuple; HeapTuple tuple;
ColumnDef *def; ColumnDef *def;
TypeName *typename; TypeName *typename;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.17 1997/08/21 01:36:09 vadim Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.18 1997/08/21 04:09:51 vadim Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -500,7 +500,7 @@ RelationBuildTupleDesc(RelationBuildDescInfo buildinfo, ...@@ -500,7 +500,7 @@ RelationBuildTupleDesc(RelationBuildDescInfo buildinfo,
build_tupdesc_seq(buildinfo, relation, natts); build_tupdesc_seq(buildinfo, relation, natts);
else else
{ {
relation->rd_att->constr = (AttrConstr *) palloc(sizeof(struct attrConstr)); relation->rd_att->constr = (TupleConstr *) palloc(sizeof(TupleConstr));
relation->rd_att->constr->num_check = 0; relation->rd_att->constr->num_check = 0;
relation->rd_att->constr->num_defval = 0; relation->rd_att->constr->num_defval = 0;
relation->rd_att->constr->has_not_null = false; relation->rd_att->constr->has_not_null = false;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: tupdesc.h,v 1.6 1997/08/19 04:45:20 vadim Exp $ * $Id: tupdesc.h,v 1.7 1997/08/21 04:10:25 vadim Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -17,23 +17,38 @@ ...@@ -17,23 +17,38 @@
#include <access/attnum.h> #include <access/attnum.h>
#include <catalog/pg_attribute.h> #include <catalog/pg_attribute.h>
typedef struct attrConstr {
/*------------------------------------------------------------------------ typedef struct attrDefault {
This structure contains flags to the constraints of a tuple AttrNumber adnum;
------------------------------------------------------------------------*/ char *adbin;
char *adsrc;
} AttrDefault;
typedef struct constrCheck {
char *ccname;
char *ccbin;
char *ccsrc;
} ConstrCheck;
/* This structure contains constraints of a tuple */
typedef struct tupleConstr {
AttrDefault *defval;
ConstrCheck *check;
uint16 num_defval;
uint16 num_check;
bool has_not_null; bool has_not_null;
} AttrConstr; } TupleConstr;
/*
* This structure contains all information (i.e. from Classes
* pg_attribute, pg_attrdef, pg_relcheck) for a tuple.
*/
typedef struct tupleDesc { typedef struct tupleDesc {
/*------------------------------------------------------------------------
This structure contains all the attribute information (i.e. from Class
pg_attribute) for a tuple.
-------------------------------------------------------------------------*/
int natts; int natts;
/* Number of attributes in the tuple */ /* Number of attributes in the tuple */
AttributeTupleForm *attrs; AttributeTupleForm *attrs;
/* attrs[N] is a pointer to the description of Attribute Number N+1. */ /* attrs[N] is a pointer to the description of Attribute Number N+1. */
AttrConstr *constr; TupleConstr *constr;
} *TupleDesc; } *TupleDesc;
extern TupleDesc CreateTemplateTupleDesc(int natts); extern TupleDesc CreateTemplateTupleDesc(int natts);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment