Skip to content
Snippets Groups Projects
Commit e24977f3 authored by Tom Lane's avatar Tom Lane
Browse files

Allow qualified type names in CREATE CAST, DROP CAST. Also allow the

construction 'SETOF type[]' which for some reason was previously
overlooked (you'd have to name the array type directly to make it work).
parent 7bcc6d98
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.398 2003/02/03 14:04:24 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.399 2003/02/05 20:16:42 tgl Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -3229,7 +3229,7 @@ any_operator: ...@@ -3229,7 +3229,7 @@ any_operator:
* *
*****************************************************************************/ *****************************************************************************/
CreateCastStmt: CREATE CAST '(' ConstTypename AS ConstTypename ')' CreateCastStmt: CREATE CAST '(' Typename AS Typename ')'
WITH FUNCTION function_with_argtypes cast_context WITH FUNCTION function_with_argtypes cast_context
{ {
CreateCastStmt *n = makeNode(CreateCastStmt); CreateCastStmt *n = makeNode(CreateCastStmt);
...@@ -3239,7 +3239,7 @@ CreateCastStmt: CREATE CAST '(' ConstTypename AS ConstTypename ')' ...@@ -3239,7 +3239,7 @@ CreateCastStmt: CREATE CAST '(' ConstTypename AS ConstTypename ')'
n->context = (CoercionContext) $11; n->context = (CoercionContext) $11;
$$ = (Node *)n; $$ = (Node *)n;
} }
| CREATE CAST '(' ConstTypename AS ConstTypename ')' | CREATE CAST '(' Typename AS Typename ')'
WITHOUT FUNCTION cast_context WITHOUT FUNCTION cast_context
{ {
CreateCastStmt *n = makeNode(CreateCastStmt); CreateCastStmt *n = makeNode(CreateCastStmt);
...@@ -3257,7 +3257,7 @@ cast_context: AS IMPLICIT_P { $$ = COERCION_IMPLICIT; } ...@@ -3257,7 +3257,7 @@ cast_context: AS IMPLICIT_P { $$ = COERCION_IMPLICIT; }
; ;
DropCastStmt: DROP CAST '(' ConstTypename AS ConstTypename ')' opt_drop_behavior DropCastStmt: DROP CAST '(' Typename AS Typename ')' opt_drop_behavior
{ {
DropCastStmt *n = makeNode(DropCastStmt); DropCastStmt *n = makeNode(DropCastStmt);
n->sourcetype = $4; n->sourcetype = $4;
...@@ -4948,9 +4948,10 @@ Typename: SimpleTypename opt_array_bounds ...@@ -4948,9 +4948,10 @@ Typename: SimpleTypename opt_array_bounds
$$ = $1; $$ = $1;
$$->arrayBounds = $2; $$->arrayBounds = $2;
} }
| SETOF SimpleTypename | SETOF SimpleTypename opt_array_bounds
{ {
$$ = $2; $$ = $2;
$$->arrayBounds = $3;
$$->setof = TRUE; $$->setof = TRUE;
} }
; ;
...@@ -5173,6 +5174,8 @@ Bit: BitWithLength ...@@ -5173,6 +5174,8 @@ Bit: BitWithLength
} }
; ;
/* ConstBit is like Bit except "BIT" defaults to unspecified length */
/* See notes for ConstCharacter, which addresses same issue for "CHAR" */
ConstBit: BitWithLength ConstBit: BitWithLength
{ {
$$ = $1; $$ = $1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment