diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-10-03 23:55:40 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-10-03 23:55:40 +0000 |
| commit | eabc714a916b772650c97b065ef27767dc5942e4 (patch) | |
| tree | 9271817f0a846e303ae8d32338b1d58a5c2754d5 /src/include/catalog/heap.h | |
| parent | f29ccc827006d13be0f4bf0255b06f3c4e921709 (diff) | |
| download | postgresql-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/catalog/heap.h')
| -rw-r--r-- | src/include/catalog/heap.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h index c8c130da96..faa708ff24 100644 --- a/src/include/catalog/heap.h +++ b/src/include/catalog/heap.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: heap.h,v 1.21 1999/09/23 17:03:10 momjian Exp $ + * $Id: heap.h,v 1.22 1999/10/03 23:55:35 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -15,6 +15,12 @@ #include "utils/rel.h" +typedef struct RawColumnDefault +{ + AttrNumber attnum; /* attribute to attach default to */ + Node *raw_default; /* default value (untransformed parse tree) */ +} RawColumnDefault; + extern Oid RelnameFindRelid(char *relname); extern Relation heap_create(char *relname, TupleDesc att, bool isnoname, bool istemp); @@ -26,6 +32,10 @@ extern void heap_destroy_with_catalog(char *relname); extern void heap_truncate(char *relname); extern void heap_destroy(Relation rel); +extern void AddRelationRawConstraints(Relation rel, + List *rawColDefaults, + List *rawConstraints); + extern void InitNoNameRelList(void); extern void DestroyNoNameRels(void); |
