mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
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.
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: builtins.h,v 1.87 1999/09/30 14:54:24 wieck Exp $
|
||||
* $Id: builtins.h,v 1.88 1999/10/03 23:55:37 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This should normally only be included by fmgr.h.
|
||||
@ -372,6 +372,14 @@ extern Oid regproctooid(RegProcedure rp);
|
||||
/* define macro to replace mixed-case function call - tgl 97/04/27 */
|
||||
#define RegprocToOid(rp) regproctooid(rp)
|
||||
|
||||
/* ruleutils.c */
|
||||
extern text *pg_get_ruledef(NameData *rname);
|
||||
extern text *pg_get_viewdef(NameData *rname);
|
||||
extern text *pg_get_indexdef(Oid indexrelid);
|
||||
extern NameData *pg_get_userbyid(int32 uid);
|
||||
extern char *deparse_expression(Node *expr, List *rangetables,
|
||||
bool forceprefix);
|
||||
|
||||
/* selfuncs.c */
|
||||
extern float64 eqsel(Oid opid, Oid relid, AttrNumber attno, Datum value, int32 flag);
|
||||
extern float64 neqsel(Oid opid, Oid relid, AttrNumber attno, Datum value, int32 flag);
|
||||
|
Reference in New Issue
Block a user