summaryrefslogtreecommitdiff
path: root/src/include/nodes/parsenodes.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-08-31 22:10:48 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-08-31 22:10:48 +0000
commit845a6c3acccea0ec34e70808787aa7d431b0d96d (patch)
treec6e162146378dc6cdb62793d3b30674b6d64d465 /src/include/nodes/parsenodes.h
parent1440acd703e04f39340f7fb3a432b028a791e038 (diff)
downloadpostgresql-845a6c3acccea0ec34e70808787aa7d431b0d96d.tar.gz
Code review for domain-constraints patch. Use a new ConstraintTest node
type for runtime constraint checks, instead of misusing the parse-time Constraint node for the purpose. Fix some damage introduced into type coercion logic; in particular ensure that a coerced expression tree will read out the correct result type when inspected (patch had broken some RelabelType cases). Enforce domain NOT NULL constraints against columns that are omitted from an INSERT.
Diffstat (limited to 'src/include/nodes/parsenodes.h')
-rw-r--r--src/include/nodes/parsenodes.h28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 19d52d7217..a426aeba02 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parsenodes.h,v 1.203 2002/08/30 19:23:20 tgl Exp $
+ * $Id: parsenodes.h,v 1.204 2002/08/31 22:10:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -233,14 +233,13 @@ typedef struct NullTest
NullTestType nulltesttype; /* IS NULL, IS NOT NULL */
} NullTest;
-/* ----------------
+/*
* BooleanTest
*
* BooleanTest represents the operation of determining whether a boolean
* is TRUE, FALSE, or UNKNOWN (ie, NULL). All six meaningful combinations
* are supported. Note that a NULL input does *not* cause a NULL result.
* The appropriate test is performed and returned as a boolean Datum.
- * ----------------
*/
typedef enum BoolTestType
@@ -256,6 +255,29 @@ typedef struct BooleanTest
} BooleanTest;
/*
+ * ConstraintTest
+ *
+ * ConstraintTest represents the operation of testing a value to see whether
+ * it meets a constraint. If so, the input value is returned as the result;
+ * if not, an error is raised.
+ */
+
+typedef enum ConstraintTestType
+{
+ CONSTR_TEST_NOTNULL,
+ CONSTR_TEST_CHECK
+} ConstraintTestType;
+
+typedef struct ConstraintTest
+{
+ NodeTag type;
+ Node *arg; /* input expression */
+ ConstraintTestType testtype; /* test type */
+ char *name; /* name of constraint (for error msgs) */
+ Node *check_expr; /* for CHECK test, a boolean expression */
+} ConstraintTest;
+
+/*
* ColumnDef - column definition (used in various creates)
*
* If the column has a default value, we may have the value expression