Note that this has changed some of the edge cases for what is accepted
as a type name and/or column id. Regression test passes, but more
tweaks may be coming...
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.179 2000/07/15 00:01:41 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.180 2000/07/28 14:47:23 thomas Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
%type <paramno> ParamNo
%type <typnam> Typename, SimpleTypename, ConstTypename
%type <paramno> ParamNo
%type <typnam> Typename, SimpleTypename, ConstTypename
- Generic, Numeric, Character, ConstDatetime, ConstInterval, Bit
-%type <str> typename, generic, numeric, character, datetime, bit
+ Generic, Numeric, Geometric, Character, ConstDatetime, ConstInterval, Bit
+%type <str> typename, generic, numeric, geometric, character, datetime, bit
%type <str> extract_arg
%type <str> opt_charset, opt_collate
%type <str> opt_float
%type <str> extract_arg
%type <str> opt_charset, opt_collate
%type <str> opt_float
def_name: PROCEDURE { $$ = "procedure"; }
| JOIN { $$ = "join"; }
| all_Op { $$ = $1; }
def_name: PROCEDURE { $$ = "procedure"; }
| JOIN { $$ = "join"; }
| all_Op { $$ = $1; }
- | typename { $$ = $1; }
- | TokenId { $$ = $1; }
- | INTERVAL { $$ = "interval"; }
- | TIME { $$ = "time"; }
- | TIMESTAMP { $$ = "timestamp"; }
;
definition: '(' def_list ')' { $$ = $2; }
;
definition: '(' def_list ')' { $$ = $2; }
-opt_class: class {
- /*
- * Release 7.0 removed network_ops, timespan_ops, and datetime_ops,
- * so we suppress it from being passed to the backend so the default
- * *_ops is used. This can be removed in some later release.
- * bjm 2000/02/07
- */
- if (strcmp($1, "network_ops") != 0 &&
- strcmp($1, "timespan_ops") != 0 &&
- strcmp($1, "datetime_ops") != 0)
- $$ = $1;
- else $$ = NULL; }
+opt_class: class
+ {
+ /*
+ * Release 7.0 removed network_ops, timespan_ops, and datetime_ops,
+ * so we suppress it from being passed to the backend so the default
+ * *_ops is used. This can be removed in some later release.
+ * bjm 2000/02/07
+ */
+ if (strcmp($1, "network_ops") != 0 &&
+ strcmp($1, "timespan_ops") != 0 &&
+ strcmp($1, "datetime_ops") != 0)
+ $$ = $1;
+ else
+ $$ = NULL;
+ }
| USING class { $$ = $2; }
| /*EMPTY*/ { $$ = NULL; }
;
| USING class { $$ = $2; }
| /*EMPTY*/ { $$ = NULL; }
;
* so that won't work here. The only thing we give up is array notation,
* which isn't meaningful in this context anyway.
* - thomas 2000-03-25
* so that won't work here. The only thing we give up is array notation,
* which isn't meaningful in this context anyway.
* - thomas 2000-03-25
- */
-func_arg: opt_arg TokenId SimpleTypename
+ * The following productions are difficult, since it is difficult to
+ * distinguish between TokenId and SimpleTypename:
+ opt_arg TokenId SimpleTypename
- /* We can catch over-specified arguments here if we want to,
- * but for now better to silently swallow typmod, etc.
- * - thomas 2000-03-22
- */
- | opt_arg SimpleTypename
+ | TokenId SimpleTypename
- | TokenId SimpleTypename
+ */
+func_arg: opt_arg SimpleTypename
+ /* We can catch over-specified arguments here if we want to,
+ * but for now better to silently swallow typmod, etc.
+ * - thomas 2000-03-22
+ */
$$ = $2;
}
| SimpleTypename
$$ = $2;
}
| SimpleTypename
ConstTypename: Generic
| Numeric
ConstTypename: Generic
| Numeric
| Bit
| Character
| ConstDatetime
| Bit
| Character
| ConstDatetime
typename: generic { $$ = $1; }
| numeric { $$ = $1; }
typename: generic { $$ = $1; }
| numeric { $$ = $1; }
+ | geometric { $$ = $1; }
| bit { $$ = $1; }
| character { $$ = $1; }
| datetime { $$ = $1; }
| bit { $$ = $1; }
| character { $$ = $1; }
| datetime { $$ = $1; }
;
generic: IDENT { $$ = $1; }
;
generic: IDENT { $$ = $1; }
- | PATH_P { $$ = "path"; }
| TYPE_P { $$ = "type"; }
;
| TYPE_P { $$ = "type"; }
;
| NUMERIC { $$ = xlateSqlType("numeric"); }
;
| NUMERIC { $$ = xlateSqlType("numeric"); }
;
+Geometric: PATH_P
+ {
+ $$ = makeNode(TypeName);
+ $$->name = xlateSqlType("path");
+ $$->typmod = -1;
+ }
+ ;
+
+geometric: PATH_P { $$ = xlateSqlType("path"); }
+ ;
+
opt_float: '(' Iconst ')'
{
if ($2 < 1)
opt_float: '(' Iconst ')'
{
if ($2 < 1)
* BETWEEN, IN, IS, ISNULL, NOTNULL, OVERLAPS
* Thanks to Tom Lane for pointing this out. - thomas 2000-03-29
*/
* BETWEEN, IN, IS, ISNULL, NOTNULL, OVERLAPS
* Thanks to Tom Lane for pointing this out. - thomas 2000-03-29
*/
-ColId: IDENT { $$ = $1; }
- | TokenId { $$ = $1; }
+ColId: generic { $$ = $1; }
| INTERVAL { $$ = "interval"; }
| NATIONAL { $$ = "national"; }
| INTERVAL { $$ = "interval"; }
| NATIONAL { $$ = "national"; }
+ | PATH_P { $$ = "path"; }
+ | SERIAL { $$ = "serial"; }
| TIME { $$ = "time"; }
| TIMESTAMP { $$ = "timestamp"; }
| TIME { $$ = "time"; }
| TIMESTAMP { $$ = "timestamp"; }
- | TYPE_P { $$ = "type"; }
;
/* Parser tokens to be used as identifiers.
;
/* Parser tokens to be used as identifiers.
| SCROLL { $$ = "scroll"; }
| SESSION { $$ = "session"; }
| SEQUENCE { $$ = "sequence"; }
| SCROLL { $$ = "scroll"; }
| SESSION { $$ = "session"; }
| SEQUENCE { $$ = "sequence"; }
- | SERIAL { $$ = "serial"; }
| SERIALIZABLE { $$ = "serializable"; }
| SET { $$ = "set"; }
| SHARE { $$ = "share"; }
| SERIALIZABLE { $$ = "serializable"; }
| SET { $$ = "set"; }
| SHARE { $$ = "share"; }
| OUT { $$ = "out"; }
| OUTER_P { $$ = "outer"; }
| OVERLAPS { $$ = "overlaps"; }
| OUT { $$ = "out"; }
| OUTER_P { $$ = "outer"; }
| OVERLAPS { $$ = "overlaps"; }
- | PATH_P { $$ = "path"; }
| POSITION { $$ = "position"; }
| PRECISION { $$ = "precision"; }
| PRIMARY { $$ = "primary"; }
| POSITION { $$ = "position"; }
| PRECISION { $$ = "precision"; }
| PRIMARY { $$ = "primary"; }