aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2002-03-07 16:35:41 +0000
committerBruce Momjian <bruce@momjian.us>2002-03-07 16:35:41 +0000
commitb976b8af803fb1b3d9ab6a5ae5e13f3a9a90da32 (patch)
treebe92fa181752e2769ea63315b21a6db472a2c3c9 /src/backend/parser
parent609f71b760d64f8ff512a5caa23d4803f664bd84 (diff)
downloadpostgresql-b976b8af803fb1b3d9ab6a5ae5e13f3a9a90da32.tar.gz
postgresql-b976b8af803fb1b3d9ab6a5ae5e13f3a9a90da32.zip
Back out domain patch until it works properly.
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/gram.y66
-rw-r--r--src/backend/parser/keywords.c3
-rw-r--r--src/backend/parser/parse_coerce.c32
-rw-r--r--src/backend/parser/parse_expr.c7
4 files changed, 11 insertions, 97 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index c1b46650917..2b1edd266ee 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.286 2002/03/06 20:34:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.287 2002/03/07 16:35:35 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -135,8 +135,7 @@ static void doNegateFloat(Value *v);
ClosePortalStmt, ClusterStmt, CommentStmt, ConstraintsSetStmt,
CopyStmt, CreateAsStmt, CreateGroupStmt, CreatePLangStmt,
CreateSchemaStmt, CreateSeqStmt, CreateStmt, CreateTrigStmt,
- CreateUserStmt, CreateDomainStmt, CreatedbStmt, CursorStmt,
- DefineStmt, DeleteStmt,
+ CreateUserStmt, CreatedbStmt, CursorStmt, DefineStmt, DeleteStmt,
DropGroupStmt, DropPLangStmt, DropSchemaStmt, DropStmt, DropTrigStmt,
DropUserStmt, DropdbStmt, ExplainStmt, FetchStmt,
GrantStmt, IndexStmt, InsertStmt, ListenStmt, LoadStmt, LockStmt,
@@ -290,8 +289,6 @@ static void doNegateFloat(Value *v);
%type <list> constraints_set_namelist
%type <boolean> constraints_set_mode
-%type <boolean> opt_as
-
/*
* If you make any token changes, remember to:
* - use "yacc -d" and update parse.h
@@ -346,7 +343,7 @@ static void doNegateFloat(Value *v);
WITHOUT
/* Keywords (in SQL92 non-reserved words) */
-%token COMMITTED, SERIALIZABLE, TYPE_P, DOMAIN_P
+%token COMMITTED, SERIALIZABLE, TYPE_P
/* Keywords for Postgres support (not in SQL92 reserved words)
*
@@ -449,7 +446,6 @@ stmt : AlterDatabaseSetStmt
| CopyStmt
| CreateStmt
| CreateAsStmt
- | CreateDomainStmt
| CreateSchemaStmt
| CreateGroupStmt
| CreateSeqStmt
@@ -780,10 +776,7 @@ DropSchemaStmt: DROP SCHEMA UserId
n->dbname = $3;
$$ = (Node *)n;
}
- ;
-
-
/*****************************************************************************
*
@@ -1468,10 +1461,7 @@ ColConstraintElem:
n->name = NULL;
if (exprIsNullConstant($2))
{
- /*
- * DEFAULT NULL should be reported as empty expr
- * Required for NOT NULL Domain overrides
- */
+ /* DEFAULT NULL should be reported as empty expr */
n->raw_expr = NULL;
}
else
@@ -2053,16 +2043,7 @@ def_list: def_elem { $$ = makeList1($1); }
| def_list ',' def_elem { $$ = lappend($1, $3); }
;
-def_elem: DEFAULT '=' b_expr
- {
- $$ = makeNode(DefElem);
- $$->defname = "default";
- if (exprIsNullConstant($3))
- $$->arg = (Node *)NULL;
- else
- $$->arg = $3;
- }
- | ColLabel '=' def_arg
+def_elem: ColLabel '=' def_arg
{
$$ = makeNode(DefElem);
$$->defname = $1;
@@ -2097,15 +2078,6 @@ DropStmt: DROP drop_type name_list
DropStmt *n = makeNode(DropStmt);
n->removeType = $2;
n->names = $3;
- n->behavior = RESTRICT; /* Restricted by default */
- $$ = (Node *)n;
- }
- | DROP DOMAIN_P name_list drop_behavior
- {
- DropStmt *n = makeNode(DropStmt);
- n->removeType = DROP_DOMAIN_P;
- n->names = $3;
- n->behavior = $4;
$$ = (Node *)n;
}
;
@@ -2138,7 +2110,7 @@ TruncateStmt: TRUNCATE opt_table relation_name
* The COMMENT ON statement can take different forms based upon the type of
* the object associated with the comment. The form of the statement is:
*
- * COMMENT ON [ [ DATABASE | DOMAIN | INDEX | RULE | SEQUENCE | TABLE | TYPE | VIEW ]
+ * COMMENT ON [ [ DATABASE | INDEX | RULE | SEQUENCE | TABLE | TYPE | VIEW ]
* <objname> | AGGREGATE <aggname> (<aggtype>) | FUNCTION
* <funcname> (arg1, arg2, ...) | OPERATOR <op>
* (leftoperand_typ rightoperand_typ) | TRIGGER <triggername> ON
@@ -2224,7 +2196,6 @@ comment_type: DATABASE { $$ = DATABASE; }
| RULE { $$ = RULE; }
| SEQUENCE { $$ = SEQUENCE; }
| TABLE { $$ = TABLE; }
- | DOMAIN_P { $$ = TYPE_P; }
| TYPE_P { $$ = TYPE_P; }
| VIEW { $$ = VIEW; }
;
@@ -3251,30 +3222,6 @@ AlterDatabaseSetStmt: ALTER DATABASE database_name VariableSetStmt
}
;
-/*****************************************************************************
- *
- * Manipulate a domain
- *
- *
- *****************************************************************************/
-
-CreateDomainStmt: CREATE DOMAIN_P name opt_as Typename ColQualList opt_collate
- {
- CreateDomainStmt *n = makeNode(CreateDomainStmt);
- n->domainname = $3;
- n->typename = $5;
- n->constraints = $6;
-
- if ($7 != NULL)
- elog(NOTICE,"CREATE DOMAIN / COLLATE %s not yet "
- "implemented; clause ignored", $7);
- $$ = (Node *)n;
- }
- ;
-
-opt_as: AS {$$ = TRUE; }
- | /* EMPTY */ {$$ = FALSE; }
- ;
/*****************************************************************************
*
@@ -5932,7 +5879,6 @@ unreserved_keyword:
| DEFERRED { $$ = "deferred"; }
| DELETE { $$ = "delete"; }
| DELIMITERS { $$ = "delimiters"; }
- | DOMAIN_P { $$ = "domain"; }
| DOUBLE { $$ = "double"; }
| DROP { $$ = "drop"; }
| EACH { $$ = "each"; }
diff --git a/src/backend/parser/keywords.c b/src/backend/parser/keywords.c
index 02aff543d02..e1f53155c43 100644
--- a/src/backend/parser/keywords.c
+++ b/src/backend/parser/keywords.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.102 2002/03/06 20:34:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.103 2002/03/07 16:35:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -97,7 +97,6 @@ static ScanKeyword ScanKeywords[] = {
{"desc", DESC},
{"distinct", DISTINCT},
{"do", DO},
- {"domain", DOMAIN_P},
{"double", DOUBLE},
{"drop", DROP},
{"each", EACH},
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index 8586d5e5cca..172142e33dc 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.65 2002/03/06 20:34:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.66 2002/03/07 16:35:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,7 +38,6 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
{
Node *result;
-
if (targetTypeId == inputTypeId ||
targetTypeId == InvalidOid ||
node == NULL)
@@ -606,32 +605,3 @@ PreferredType(CATEGORY category, Oid type)
}
return result;
} /* PreferredType() */
-
-
-/*
- * If the targetTypeId is a domain, we really want to coerce
- * the tuple to the domain type -- not the domain itself
- */
-Oid
-getBaseType(Oid inType)
-{
- HeapTuple tup;
- Form_pg_type typTup;
-
- tup = SearchSysCache(TYPEOID,
- ObjectIdGetDatum(inType),
- 0, 0, 0);
-
- typTup = ((Form_pg_type) GETSTRUCT(tup));
-
- /*
- * Assume that typbasetype exists and is a base type, where inType
- * was a domain
- */
- if (typTup->typtype == 'd')
- inType = typTup->typbasetype;
-
- ReleaseSysCache(tup);
-
- return inType;
-} \ No newline at end of file
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index b095fa44b87..f740d632cc1 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.106 2002/03/06 20:34:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.107 2002/03/07 16:35:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1027,8 +1027,7 @@ parser_typecast_expression(ParseState *pstate,
if (inputType != targetType)
{
expr = CoerceTargetExpr(pstate, expr, inputType,
- getBaseType(targetType),
- typename->typmod);
+ targetType, typename->typmod);
if (expr == NULL)
elog(ERROR, "Cannot cast type '%s' to '%s'",
format_type_be(inputType),
@@ -1040,7 +1039,7 @@ parser_typecast_expression(ParseState *pstate,
* as well as a type coercion.
*/
expr = coerce_type_typmod(pstate, expr,
- getBaseType(targetType), typename->typmod);
+ targetType, typename->typmod);
return expr;
}