summaryrefslogtreecommitdiff
path: root/src/include/access/tupdesc.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-10-03 23:55:40 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-10-03 23:55:40 +0000
commiteabc714a916b772650c97b065ef27767dc5942e4 (patch)
tree9271817f0a846e303ae8d32338b1d58a5c2754d5 /src/include/access/tupdesc.h
parentf29ccc827006d13be0f4bf0255b06f3c4e921709 (diff)
downloadpostgresql-eabc714a916b772650c97b065ef27767dc5942e4.tar.gz
Reimplement parsing and storage of default expressions and constraint
expressions in CREATE TABLE. There is no longer an emasculated expression syntax for these things; it's full a_expr for constraints, and b_expr for defaults (unfortunately the fact that NOT NULL is a part of the column constraint syntax causes a shift/reduce conflict if you try a_expr. Oh well --- at least parenthesized boolean expressions work now). Also, stored expression for a column default is not pre-coerced to the column type; we rely on transformInsertStatement to do that when the default is actually used. This means "f1 datetime default 'now'" behaves the way people usually expect it to. BTW, all the support code is now there to implement ALTER TABLE ADD CONSTRAINT and ALTER TABLE ADD COLUMN with a default value. I didn't actually teach ALTER TABLE to call it, but it wouldn't be much work.
Diffstat (limited to 'src/include/access/tupdesc.h')
-rw-r--r--src/include/access/tupdesc.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/include/access/tupdesc.h b/src/include/access/tupdesc.h
index c1b30598b9..3ff678d48f 100644
--- a/src/include/access/tupdesc.h
+++ b/src/include/access/tupdesc.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: tupdesc.h,v 1.24 1999/07/16 17:07:28 momjian Exp $
+ * $Id: tupdesc.h,v 1.25 1999/10/03 23:55:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,22 +21,20 @@
typedef struct attrDefault
{
AttrNumber adnum;
- char *adbin;
- char *adsrc;
+ char *adbin; /* nodeToString representation of expr */
} AttrDefault;
typedef struct constrCheck
{
char *ccname;
- char *ccbin;
- char *ccsrc;
+ char *ccbin; /* nodeToString representation of expr */
} ConstrCheck;
/* This structure contains constraints of a tuple */
typedef struct tupleConstr
{
- AttrDefault *defval;
- ConstrCheck *check;
+ AttrDefault *defval; /* array */
+ ConstrCheck *check; /* array */
uint16 num_defval;
uint16 num_check;
bool has_not_null;