Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit20f6a1e

Browse files
author
Thomas G. Lockhart
committed
Fix acceptance of PATH as a type and column name.
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...
1 parentd2d7865 commit20f6a1e

File tree

1 file changed

+46
-34
lines changed

1 file changed

+46
-34
lines changed

‎src/backend/parser/gram.y

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.179 2000/07/15 00:01:41 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.180 2000/07/28 14:47:23 thomas Exp $
1515
*
1616
* HISTORY
1717
* AUTHORDATEMAJOR EVENT
@@ -251,8 +251,8 @@ static void doNegateFloat(Value *v);
251251
%type<paramno>ParamNo
252252

253253
%type<typnam>Typename,SimpleTypename,ConstTypename
254-
Generic,Numeric,Character,ConstDatetime,ConstInterval,Bit
255-
%type<str>typename,generic,numeric,character,datetime,bit
254+
Generic,Numeric,Geometric,Character,ConstDatetime,ConstInterval,Bit
255+
%type<str>typename,generic,numeric,geometric,character,datetime,bit
256256
%type<str>extract_arg
257257
%type<str>opt_charset,opt_collate
258258
%type<str>opt_float
@@ -1864,11 +1864,7 @@ def_type: OPERATOR{ $$ = OPERATOR; }
18641864
def_name:PROCEDURE{$$ ="procedure"; }
18651865
|JOIN{$$ ="join"; }
18661866
|all_Op{$$ =$1; }
1867-
|typename{$$ =$1; }
1868-
|TokenId{$$ =$1; }
1869-
|INTERVAL{$$ ="interval"; }
1870-
|TIME{$$ ="time"; }
1871-
|TIMESTAMP{$$ ="timestamp"; }
1867+
|ColId{$$ =$1; }
18721868
;
18731869

18741870
definition:'('def_list')'{$$ =$2; }
@@ -2361,18 +2357,21 @@ index_elem: attr_name opt_class
23612357
}
23622358
;
23632359

2364-
opt_class:class{
2365-
/*
2366-
* Release 7.0 removed network_ops, timespan_ops, and datetime_ops,
2367-
* so we suppress it from being passed to the backend so the default
2368-
* *_ops is used. This can be removed in some later release.
2369-
* bjm 2000/02/07
2370-
*/
2371-
if (strcmp($1,"network_ops") !=0 &&
2372-
strcmp($1,"timespan_ops") != 0 &&
2373-
strcmp($1,"datetime_ops") != 0)
2374-
$$ = $1;
2375-
else$$ =NULL; }
2360+
opt_class:class
2361+
{
2362+
/*
2363+
* Release 7.0 removed network_ops, timespan_ops, and datetime_ops,
2364+
* so we suppress it from being passed to the backend so the default
2365+
* *_ops is used. This can be removed in some later release.
2366+
* bjm 2000/02/07
2367+
*/
2368+
if (strcmp($1,"network_ops") !=0 &&
2369+
strcmp($1,"timespan_ops") != 0 &&
2370+
strcmp($1,"datetime_ops") != 0)
2371+
$$ = $1;
2372+
else
2373+
$$ =NULL;
2374+
}
23762375
|USINGclass{$$ =$2; }
23772376
|/*EMPTY*/{$$ =NULL; }
23782377
;
@@ -2465,21 +2464,23 @@ func_args_list: func_arg
24652464
* so that won't work here. The only thing we give up is array notation,
24662465
* which isn't meaningful in this context anyway.
24672466
* - thomas 2000-03-25
2468-
*/
2469-
func_arg:opt_argTokenIdSimpleTypename
2467+
* The following productions are difficult, since it is difficult to
2468+
* distinguish between TokenId and SimpleTypename:
2469+
opt_arg TokenId SimpleTypename
24702470
{
2471-
/* We can catch over-specified arguments here if we want to,
2472-
* but for now better to silently swallow typmod, etc.
2473-
* - thomas 2000-03-22
2474-
*/
24752471
$$ = $3;
24762472
}
2477-
|opt_argSimpleTypename
2473+
|TokenId SimpleTypename
24782474
{
24792475
$$ = $2;
24802476
}
2481-
|TokenIdSimpleTypename
2477+
*/
2478+
func_arg:opt_argSimpleTypename
24822479
{
2480+
/* We can catch over-specified arguments here if we want to,
2481+
* but for now better to silently swallow typmod, etc.
2482+
* - thomas 2000-03-22
2483+
*/
24832484
$$ =$2;
24842485
}
24852486
|SimpleTypename
@@ -3964,13 +3965,15 @@ SimpleTypename: ConstTypename
39643965

39653966
ConstTypename:Generic
39663967
|Numeric
3968+
|Geometric
39673969
|Bit
39683970
|Character
39693971
|ConstDatetime
39703972
;
39713973

39723974
typename:generic{$$ =$1; }
39733975
|numeric{$$ =$1; }
3976+
|geometric{$$ =$1; }
39743977
|bit{$$ =$1; }
39753978
|character{$$ =$1; }
39763979
|datetime{$$ =$1; }
@@ -3985,7 +3988,6 @@ Generic: generic
39853988
;
39863989

39873990
generic:IDENT{$$ =$1; }
3988-
|PATH_P{$$ ="path"; }
39893991
|TYPE_P{$$ ="type"; }
39903992
;
39913993

@@ -4033,6 +4035,17 @@ numeric: FLOAT{ $$ = xlateSqlType("float"); }
40334035
|NUMERIC {$$ = xlateSqlType("numeric"); }
40344036
;
40354037

4038+
Geometric:PATH_P
4039+
{
4040+
$$ = makeNode(TypeName);
4041+
$$->name = xlateSqlType("path");
4042+
$$->typmod = -1;
4043+
}
4044+
;
4045+
4046+
geometric:PATH_P{$$ = xlateSqlType("path"); }
4047+
;
4048+
40364049
opt_float:'('Iconst')'
40374050
{
40384051
if ($2 <1)
@@ -5451,14 +5464,15 @@ UserId: ColId{ $$ = $1; };
54515464
* BETWEEN, IN, IS, ISNULL, NOTNULL, OVERLAPS
54525465
* Thanks to Tom Lane for pointing this out. - thomas 2000-03-29
54535466
*/
5454-
ColId:IDENT{$$ =$1; }
5455-
|TokenId{$$ =$1; }
5467+
ColId:generic{$$ =$1; }
54565468
|datetime{$$ =$1; }
5469+
|TokenId{$$ =$1; }
54575470
|INTERVAL{$$ ="interval"; }
54585471
|NATIONAL{$$ ="national"; }
5472+
|PATH_P{$$ ="path"; }
5473+
|SERIAL{$$ ="serial"; }
54595474
|TIME{$$ ="time"; }
54605475
|TIMESTAMP{$$ ="timestamp"; }
5461-
|TYPE_P{$$ ="type"; }
54625476
;
54635477

54645478
/* Parser tokens to be used as identifiers.
@@ -5553,7 +5567,6 @@ TokenId: ABSOLUTE{ $$ = "absolute"; }
55535567
|SCROLL{$$ ="scroll"; }
55545568
|SESSION{$$ ="session"; }
55555569
|SEQUENCE{$$ ="sequence"; }
5556-
|SERIAL{$$ ="serial"; }
55575570
|SERIALIZABLE{$$ ="serializable"; }
55585571
|SET{$$ ="set"; }
55595572
|SHARE{$$ ="share"; }
@@ -5680,7 +5693,6 @@ ColLabel: ColId{ $$ = $1; }
56805693
|OUT{$$ ="out"; }
56815694
|OUTER_P{$$ ="outer"; }
56825695
|OVERLAPS{$$ ="overlaps"; }
5683-
|PATH_P{$$ ="path"; }
56845696
|POSITION{$$ ="position"; }
56855697
|PRECISION{$$ ="precision"; }
56865698
|PRIMARY{$$ ="primary"; }

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp