aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/gram.y38
-rw-r--r--src/backend/parser/parse_expr.c17
-rw-r--r--src/backend/parser/parse_utilcmd.c3
3 files changed, 20 insertions, 38 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 1452fe7ff2b..f9f7a49a312 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.603 2007/09/24 01:29:28 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.604 2007/10/29 19:40:39 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -1685,14 +1685,7 @@ alter_rel_cmd:
;
alter_column_default:
- SET DEFAULT a_expr
- {
- /* Treat SET DEFAULT NULL the same as DROP DEFAULT */
- if (exprIsNullConstant($3))
- $$ = NULL;
- else
- $$ = $3;
- }
+ SET DEFAULT a_expr { $$ = $3; }
| DROP DEFAULT { $$ = NULL; }
;
@@ -2080,15 +2073,7 @@ ColConstraintElem:
Constraint *n = makeNode(Constraint);
n->contype = CONSTR_DEFAULT;
n->name = NULL;
- if (exprIsNullConstant($2))
- {
- /* DEFAULT NULL should be reported as empty expr */
- n->raw_expr = NULL;
- }
- else
- {
- n->raw_expr = $2;
- }
+ n->raw_expr = $2;
n->cooked_expr = NULL;
n->keys = NULL;
n->indexspace = NULL;
@@ -9763,23 +9748,6 @@ parser_init(void)
QueryIsRule = FALSE;
}
-/* exprIsNullConstant()
- * Test whether an a_expr is a plain NULL constant or not.
- */
-bool
-exprIsNullConstant(Node *arg)
-{
- if (arg && IsA(arg, A_Const))
- {
- A_Const *con = (A_Const *) arg;
-
- if (con->val.type == T_Null &&
- con->typename == NULL)
- return TRUE;
- }
- return FALSE;
-}
-
/* doNegate()
* Handle negation of a numeric constant.
*
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index 754e18d687c..86fddc4a7a6 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.221 2007/06/23 22:12:51 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.222 2007/10/29 19:40:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -606,6 +606,21 @@ transformParamRef(ParseState *pstate, ParamRef *pref)
return (Node *) param;
}
+/* Test whether an a_expr is a plain NULL constant or not */
+static bool
+exprIsNullConstant(Node *arg)
+{
+ if (arg && IsA(arg, A_Const))
+ {
+ A_Const *con = (A_Const *) arg;
+
+ if (con->val.type == T_Null &&
+ con->typename == NULL)
+ return true;
+ }
+ return false;
+}
+
static Node *
transformAExprOp(ParseState *pstate, A_Expr *a)
{
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index 54e7dfdb161..287e82ddeec 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -19,7 +19,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.3 2007/08/27 03:36:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.4 2007/10/29 19:40:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -440,7 +440,6 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("multiple default values specified for column \"%s\" of table \"%s\"",
column->colname, cxt->relation->relname)));
- /* Note: DEFAULT NULL maps to constraint->raw_expr == NULL */
column->raw_default = constraint->raw_expr;
Assert(constraint->cooked_expr == NULL);
saw_default = true;