aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas G. Lockhart <lockhart@fourpalms.org>1997-11-30 23:11:10 +0000
committerThomas G. Lockhart <lockhart@fourpalms.org>1997-11-30 23:11:10 +0000
commit07c1837f5071fba2d151cbd205f9073fe3a9ff90 (patch)
tree804d059a4a297a2a32f643c26271c2c79e10350f /src
parent361f9e7f8d72d98319e1d2a061e2aa1310fe4254 (diff)
downloadpostgresql-07c1837f5071fba2d151cbd205f9073fe3a9ff90.tar.gz
postgresql-07c1837f5071fba2d151cbd205f9073fe3a9ff90.zip
Change elog WARN messages for UNIQUE and PRIMARY, FOREIGN KEY
to NOTICE messages so that execution proceeds rather than halting. These clauses are ignored as stated in the messages. Allow NOT NULL UNIQUE syntax (both were allowed individually before). Allow Postgres-style casting ("::") of non-constants.
Diffstat (limited to 'src')
-rw-r--r--src/backend/parser/gram.y53
1 files changed, 39 insertions, 14 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index d146b6e4ce1..3d4bd3ea30c 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.72 1997/11/25 22:05:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.73 1997/11/30 23:11:10 thomas Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -566,20 +566,25 @@ default_expr: AexprConst
;
opt_constraint: NOT NULL_P { $$ = TRUE; }
+ | NOT NULL_P UNIQUE
+ {
+ elog(NOTICE,"UNIQUE clause ignored; not yet implemented",NULL);
+ $$ = TRUE;
+ }
| NOTNULL { $$ = TRUE; }
| UNIQUE
{
- elog(WARN,"CREATE TABLE/UNIQUE not yet implemented",NULL);
+ elog(NOTICE,"UNIQUE clause ignored; not yet implemented",NULL);
$$ = FALSE;
}
| PRIMARY KEY
{
- elog(WARN,"CREATE TABLE/PRIMARY KEY not yet implemented",NULL);
+ elog(NOTICE,"PRIMARY KEY clause ignored; not yet implemented",NULL);
$$ = FALSE;
}
| REFERENCES ColId opt_column_list key_match key_actions
{
- elog(WARN,"CREATE TABLE/FOREIGN KEY not yet implemented",NULL);
+ elog(NOTICE,"FOREIGN KEY clause ignored; not yet implemented",NULL);
$$ = FALSE;
}
| /* EMPTY */ { $$ = FALSE; }
@@ -728,9 +733,15 @@ ConstraintDef: CHECK constraint_elem
| UNIQUE '(' columnList ')'
{ elog(WARN,"CREATE TABLE/UNIQUE not yet implemented",NULL); }
| PRIMARY KEY '(' columnList ')'
- { elog(WARN,"CREATE TABLE/PRIMARY KEY not yet implemented",NULL); }
+ {
+ ConstraintDef *constr = palloc (sizeof(ConstraintDef));
+ constr->type = CONSTR_PRIMARY;
+ constr->name = NULL;
+ constr->keys = $4;
+ $$ = constr;
+ }
| FOREIGN KEY '(' columnList ')' REFERENCES ColId opt_column_list key_match key_actions
- { elog(WARN,"CREATE TABLE/FOREIGN KEY not yet implemented",NULL); }
+ { elog(NOTICE,"FOREIGN KEY clause ignored; not yet implemented",NULL); }
;
constraint_elem: AexprConst
@@ -2607,14 +2618,21 @@ a_expr: attr opt_indirection
{ $$ = makeA_Expr(OP, ";", NULL, $2); }
| '|' a_expr
{ $$ = makeA_Expr(OP, "|", NULL, $2); }
- | AexprConst TYPECAST Typename
+ | a_expr TYPECAST Typename
{
+ $$ = (Node *)$1;
/* AexprConst can be either A_Const or ParamNo */
- if (nodeTag($1) == T_A_Const)
+ if (nodeTag($1) == T_A_Const) {
((A_Const *)$1)->typename = $3;
- else
+ } else if (nodeTag($1) == T_Param) {
((ParamNo *)$1)->typename = $3;
- $$ = (Node *)$1;
+ /* otherwise, try to transform to a function call */
+ } else {
+ FuncCall *n = makeNode(FuncCall);
+ n->funcname = $3->name;
+ n->args = lcons($1,NIL);
+ $$ = (Node *)n;
+ }
}
| CAST a_expr AS Typename
{
@@ -2950,14 +2968,21 @@ position_expr: attr opt_indirection
{ $$ = makeA_Expr(OP, "*", $1, $3); }
| '|' position_expr
{ $$ = makeA_Expr(OP, "|", NULL, $2); }
- | AexprConst TYPECAST Typename
+ | position_expr TYPECAST Typename
{
+ $$ = (Node *)$1;
/* AexprConst can be either A_Const or ParamNo */
- if (nodeTag($1) == T_A_Const)
+ if (nodeTag($1) == T_A_Const) {
((A_Const *)$1)->typename = $3;
- else
+ } else if (nodeTag($1) == T_Param) {
((ParamNo *)$1)->typename = $3;
- $$ = (Node *)$1;
+ /* otherwise, try to transform to a function call */
+ } else {
+ FuncCall *n = makeNode(FuncCall);
+ n->funcname = $3->name;
+ n->args = lcons($1,NIL);
+ $$ = (Node *)n;
+ }
}
| CAST position_expr AS Typename
{