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

Commit4b19101

Browse files
author
Thomas G. Lockhart
committed
Update UNION and subselect syntax.
Support SQL92 syntax for type coersion of strings (type 'typeval'). Example: "DATETIME 'now'". This works only for string constants and can not replace the CAST and ::type syntax which behave identically in this context.
1 parent6df9626 commit4b19101

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

‎src/backend/parser/gram.y

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.67 1997/11/15 20:57:09 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.68 1997/11/17 16:37:24 thomas Exp $
1414
*
1515
* HISTORY
1616
* AUTHORDATEMAJOR EVENT
@@ -153,7 +153,9 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr);
153153

154154
%type <list>union_clause, select_list
155155
%type <list>join_list
156-
%type <sortgroupby>join_using
156+
%type <sortgroupby>
157+
join_using
158+
%type <boolean>opt_union
157159

158160
%type <node>position_expr
159161
%type <list>extract_list, position_list
@@ -1130,7 +1132,7 @@ FetchStmt:FETCH opt_direction fetch_how_many opt_portal_name
11301132
n->direction = $2;
11311133
n->howMany = $3;
11321134
n->portalname = $4;
1133-
n->ismove =true;
1135+
n->ismove =TRUE;
11341136
$$ = (Node *)n;
11351137
}
11361138
;
@@ -2097,27 +2099,27 @@ RetrieveStmt: SELECT opt_unique res_target_list2
20972099
}
20982100
;
20992101

2100-
union_clause: UNION select_list{ $$ = $2; }
2102+
union_clause: UNIONopt_unionselect_list{ $$ = $3; }
21012103
| /*EMPTY*/{ $$ = NIL; }
21022104
;
21032105

2104-
select_list: select_list UNION SubSelect
2105-
{ $$ = lappend($1, $3); }
2106+
select_list: select_list UNIONopt_unionSubSelect
2107+
{ $$ = lappend($1, $4); }
21062108
| SubSelect
21072109
{ $$ = lcons($1, NIL); }
21082110
;
21092111

21102112
SubSelect:SELECT opt_unique res_target_list2
2111-
resultfrom_clause where_clause
2113+
from_clause where_clause
21122114
group_clause having_clause
21132115
{
21142116
SubSelect *n = makeNode(SubSelect);
21152117
n->unique = $2;
21162118
n->targetList = $3;
2117-
n->fromClause = $5;
2118-
n->whereClause = $6;
2119-
n->groupClause = $7;
2120-
n->havingClause = $8;
2119+
n->fromClause = $4;
2120+
n->whereClause = $5;
2121+
n->groupClause = $6;
2122+
n->havingClause = $7;
21212123
$$ = (Node *)n;
21222124
}
21232125
;
@@ -2128,9 +2130,14 @@ result: INTO TABLE relation_name
21282130
{ $$ = NULL; }
21292131
;
21302132

2133+
opt_union: ALL{ $$ = TRUE; }
2134+
| /*EMPTY*/{ $$ = FALSE; }
2135+
;
2136+
21312137
opt_unique: DISTINCT{ $$ = "*"; }
21322138
| DISTINCT ON ColId{ $$ = $3; }
2133-
| /*EMPTY*/{ $$ = NULL;}
2139+
| ALL{ $$ = NULL; }
2140+
| /*EMPTY*/{ $$ = NULL; }
21342141
;
21352142

21362143
sort_clause: ORDER BY sortby_list{ $$ = $3; }
@@ -3416,6 +3423,14 @@ AexprConst: Iconst
34163423
n->val.val.str = $1;
34173424
$$ = (Node *)n;
34183425
}
3426+
| Typename Sconst
3427+
{
3428+
A_Const *n = makeNode(A_Const);
3429+
n->typename = $1;
3430+
n->val.type = T_String;
3431+
n->val.val.str = $2;
3432+
$$ = (Node *)n;
3433+
}
34193434
| ParamNo
34203435
{$$ = (Node *)$1; }
34213436
| TRUE_P

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp