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

Commit88ce6a2

Browse files
author
Michael Meskes
committed
Synced preproc.y with gram.y and added missing include file to pgc.l.
1 parent0fada37 commit88ce6a2

File tree

3 files changed

+57
-56
lines changed

3 files changed

+57
-56
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,8 +1035,9 @@ Fri Dec 22 13:33:31 CET 2000
10351035
- Fixed bug in a connect statement using varchars.
10361036
- Synced gram.y and preproc.y.
10371037

1038-
Tue Jan 9 20:24:56 CET 2001
1038+
Mon Jan22 17:56:02 CET 2001
10391039

1040-
- Synced gram.y.
1040+
- Synced gram.y and preproc.y.
1041+
- Added #include "postgres.h" to pgc.l.
10411042
- Set ecpg version to 2.8.0.
10421043
- Set library version to 3.2.0.

‎src/interfaces/ecpg/preproc/pgc.l

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,16 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.71 2001/01/1405:08:17 tgl Exp $
15+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.72 2001/01/22 17:05:50 meskes Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
19-
#include"postgres.h"
20-
2119
#include<ctype.h>
2220
#include<sys/types.h>
2321
#include<limits.h>
2422
#include<errno.h>
2523

24+
#include"postgres.h"
2625
#include"miscadmin.h"
2726
#include"nodes/parsenodes.h"
2827
#include"nodes/pg_list.h"

‎src/interfaces/ecpg/preproc/preproc.y

Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ make_name(void)
294294
%type<str>opt_indirectionexpr_listextract_listextract_arg
295295
%type<str>position_listsubstr_listsubstr_fromalter_column_action
296296
%type<str>trim_listin_exprsubstr_forattrattrsdrop_behavior
297-
%type<str>TypenameSimpleTypenameGenericTypeNumericopt_floatopt_numeric
297+
%type<str>TypenameSimpleTypenameGenericNumericgenericopt_floatopt_numeric
298298
%type<str>opt_decimalCharactercharacteropt_varyingopt_charset
299299
%type<str>opt_collatedatetimeopt_timezoneopt_intervaltable_ref
300300
%type<str>row_exprrow_descriptorrow_listConstDatetimeopt_chain
@@ -313,7 +313,7 @@ make_name(void)
313313
%type<str>index_listfunc_indexindex_elemopt_classaccess_method_clause
314314
%type<str>index_opt_uniqueIndexStmtfunc_returnConstInterval
315315
%type<str>func_args_listfunc_argsopt_withProcedureStmtdef_arg
316-
%type<str>def_elemdef_listdefinitionDefineStmt
316+
%type<str>def_elemdef_listdefinitionDefineStmtselect_with_parens
317317
%type<str>opt_insteadeventevent_objectRuleActionListopt_using
318318
%type<str>RuleActionStmtOrEmptyRuleActionMultifunc_asreindex_type
319319
%type<str>RuleStmtopt_columnopt_nameoper_argtypessysid_clause
@@ -2066,16 +2066,7 @@ RuleActionMulti: RuleActionMulti ';' RuleActionStmtOrEmpty
20662066
{$$ = cat2_str($1, make_str(";")); }
20672067
;
20682068

2069-
/*
2070-
* Allowing RuleActionStmt to be a SelectStmt creates an ambiguity:
2071-
* is the RuleActionList "((SELECT foo))" a standalone RuleActionStmt,
2072-
* or a one-entry RuleActionMulti list? We don't really care, but yacc
2073-
* wants to know. We use operator precedence to resolve the ambiguity:
2074-
* giving this rule a higher precedence than ')' will force a reduce
2075-
* rather than shift decision, causing the one-entry-list interpretation
2076-
* to be chosen.
2077-
*/
2078-
RuleActionStmt:SelectStmt %precTYPECAST
2069+
RuleActionStmt:SelectStmt
20792070
|InsertStmt
20802071
|UpdateStmt
20812072
|DeleteStmt
@@ -2491,11 +2482,17 @@ opt_cursor: BINARY { $$ = make_str("binary"); }
24912482
*
24922483
*****************************************************************************/
24932484

2494-
SelectStmt:select_no_parens %precTYPECAST
2485+
SelectStmt:select_no_parens %precUMINUS
2486+
{$$ =$1; }
2487+
|select_with_parens%precUMINUS
2488+
{$$ =$1; }
2489+
;
2490+
2491+
select_with_parens:'('select_no_parens')'
24952492
{
2496-
$$ =$1;
2493+
$$ =cat_str(3, make_str("("),$2, make_str(")"));
24972494
}
2498-
|'('SelectStmt')'
2495+
|'('select_with_parens')'
24992496
{
25002497
$$ = cat_str(3, make_str("("),$2, make_str(")"));
25012498
}
@@ -2524,9 +2521,9 @@ select_clause: simple_select
25242521
$$ =$1;
25252522

25262523
}
2527-
|'('SelectStmt')'
2524+
|select_with_parens
25282525
{
2529-
$$ =cat_str(3, make_str("("),$2, make_str(")"));
2526+
$$ =$1;
25302527
}
25312528
;
25322529

@@ -2745,10 +2742,6 @@ from_list: from_list ',' table_ref{ $$ = cat_str(3, $1, make_str(","), $3); }
27452742
* between table_ref := '(' joined_table ')' alias_clause
27462743
* and joined_table := '(' joined_table ')'. So, we must have the
27472744
* redundant-looking productions here instead.
2748-
*
2749-
* Note that the SQL spec does not permit a subselect (<derived_table>)
2750-
* without an alias clause, so we don't either. This avoids the problem
2751-
* of needing to invent a refname for an unlabeled subselect.
27522745
*/
27532746
table_ref:relation_expr
27542747
{
@@ -2758,9 +2751,13 @@ table_ref: relation_expr
27582751
{
27592752
$$= cat2_str($1,$2);
27602753
}
2761-
|'('SelectStmt')'alias_clause
2754+
|select_with_parens
2755+
{
2756+
mmerror(ET_ERROR,"sub-SELECT in FROM must have an alias");
2757+
}
2758+
|select_with_parensalias_clause
27622759
{
2763-
$$=cat_str(4, make_str("("),$2, make_str(")"),$4);
2760+
$$=cat2_str($1,$2);
27642761
}
27652762
|joined_table
27662763
{
@@ -2856,12 +2853,12 @@ relation_expr:relation_name
28562853
/* normal relations*/
28572854
$$ =$1;
28582855
}
2859-
|relation_name'*' %prec'='
2856+
|relation_name'*'
28602857
{
28612858
/* inheritance query*/
28622859
$$ = cat2_str($1, make_str("*"));
28632860
}
2864-
|ONLYrelation_name %prec'='
2861+
|ONLYrelation_name
28652862
{
28662863
/* inheritance query*/
28672864
$$ = cat2_str(make_str("ONLY"),$2);
@@ -2928,15 +2925,22 @@ SimpleTypename: ConstTypename{ $$ = $1; }
29282925
|ConstInterval{$$ =$1; }
29292926
;
29302927

2931-
ConstTypename:GenericType{$$ =$1; }
2928+
ConstTypename:Generic{$$ =$1; }
29322929
|ConstDatetime{$$ =$1; }
29332930
|Numeric{$$ =$1; }
29342931
|Geometric{$$ =$1; }
29352932
|Bit{$$ =$1; }
29362933
|Character{$$ =$1; }
29372934
;
29382935

2939-
GenericType:ident{$$ =$1; }
2936+
Generic:generic
2937+
{
2938+
$$ =$1;
2939+
}
2940+
;
2941+
2942+
generic:ident{$$ =$1; }
2943+
|TYPE_P{$$ = make_str("type"); }
29402944
|ECPGKeywords{$$ =$1; }
29412945
|ECPGTypeName{$$ =$1; }
29422946
;
@@ -3170,21 +3174,21 @@ opt_interval: datetime{ $$ = $1; }
31703174
* Define row_descriptor to allow yacc to break the reduce/reduce conflict
31713175
* with singleton expressions.
31723176
*/
3173-
row_expr:'('row_descriptor')'IN'('SelectStmt')'
3177+
row_expr:'('row_descriptor')'INselect_with_parens
31743178
{
3175-
$$ = cat_str(5, make_str("("),$2, make_str(") in("),$6, make_str(")"));
3179+
$$ = cat_str(4, make_str("("),$2, make_str(") in"),$5);
31763180
}
3177-
|'('row_descriptor')'NOTIN'('SelectStmt')'
3181+
|'('row_descriptor')'NOTINselect_with_parens
31783182
{
3179-
$$ = cat_str(5, make_str("("),$2, make_str(") not in("),$7, make_str(")"));
3183+
$$ = cat_str(4, make_str("("),$2, make_str(") not in"),$6);
31803184
}
3181-
|'('row_descriptor')'all_Opsub_type'('SelectStmt')'
3185+
|'('row_descriptor')'all_Opsub_typeselect_with_parens
31823186
{
3183-
$$ = cat_str(8, make_str("("),$2, make_str(")"),$4,$5,make_str("("),$7, make_str(")"));
3187+
$$ = cat_str(6, make_str("("),$2, make_str(")"),$4,$5,$6);
31843188
}
3185-
|'('row_descriptor')'all_Op'('SelectStmt')'
3189+
|'('row_descriptor')'all_Opselect_with_parens
31863190
{
3187-
$$ = cat_str(7, make_str("("),$2, make_str(")"),$4,make_str("("),$6, make_str(")"));
3191+
$$ = cat_str(5, make_str("("),$2, make_str(")"),$4,$5);
31883192
}
31893193
|'('row_descriptor')'all_Op'('row_descriptor')'
31903194
{
@@ -3349,17 +3353,17 @@ a_expr: c_expr
33493353
{
33503354
$$ = cat_str(5,$1, make_str("not between"),$4, make_str("and"),$6);
33513355
}
3352-
|a_exprIN'('in_expr')'
3356+
|a_exprINin_expr
33533357
{
3354-
$$ = cat_str(4,$1, make_str(" in ("),$4, make_str(")"));
3358+
$$ = cat_str(3,$1, make_str(" in"),$3);
33553359
}
3356-
|a_exprNOTIN'('in_expr')'
3360+
|a_exprNOTINin_expr
33573361
{
3358-
$$ = cat_str(4,$1, make_str(" not in("),$5, make_str(")"));
3362+
$$ = cat_str(3,$1, make_str(" not in"),$4);
33593363
}
3360-
|a_exprall_Opsub_type'('SelectStmt')'
3364+
|a_exprall_Opsub_typeselect_with_parens
33613365
{
3362-
$$ = cat_str(6,$1,$2,$3,make_str("("),$5, make_str(")"));
3366+
$$ = cat_str(4,$1,$2,$3,$4);
33633367
}
33643368
|row_expr
33653369
{$$ =$1; }
@@ -3494,10 +3498,10 @@ c_expr: attr
34943498
{$$ = cat_str(3, make_str("trim(trailing"),$4, make_str(")")); }
34953499
|TRIM'('trim_list')'
34963500
{$$ = cat_str(3, make_str("trim("),$3, make_str(")")); }
3497-
|'('select_no_parens')'
3498-
{$$ =cat_str(3, make_str("("),$2, make_str(")")); }
3499-
|EXISTS'('SelectStmt')'
3500-
{$$ =cat_str(3,make_str("exists("),$3, make_str(")")); }
3501+
|select_with_parens%precUMINUS
3502+
{$$ =$1; }
3503+
|EXISTSselect_with_parens
3504+
{$$ =cat2_str(make_str("exists"),$2); }
35013505
;
35023506
/*
35033507
* This used to use ecpg_expr, but since there is no shift/reduce conflict
@@ -3583,12 +3587,12 @@ trim_list: a_expr FROM expr_list
35833587
{$$ =$1; }
35843588
;
35853589

3586-
in_expr:SelectStmt
3590+
in_expr:select_with_parens
35873591
{
35883592
$$ =$1;
35893593
}
3590-
|in_expr_nodes
3591-
{$$ =$1; }
3594+
|'('in_expr_nodes')'
3595+
{$$ =cat_str(3, make_str("("),$2, make_str(")")); }
35923596
;
35933597

35943598
in_expr_nodes:a_expr
@@ -5069,7 +5073,6 @@ TokenId: ABSOLUTE{ $$ = make_str("absolute"); }
50695073
|TRIGGER{$$ = make_str("trigger"); }
50705074
|TRUNCATE{$$ = make_str("truncate"); }
50715075
|TRUSTED{$$ = make_str("trusted"); }
5072-
|TYPE_P{$$ = make_str("type"); }
50735076
|UNLISTEN{$$ = make_str("unlisten"); }
50745077
|UNTIL{$$ = make_str("until"); }
50755078
|UPDATE{$$ = make_str("update"); }
@@ -5103,7 +5106,6 @@ ECPGColLabel: ECPGColId{ $$ = $1; }
51035106
|ALL{$$ = make_str("all"); }
51045107
|ANALYSE {$$ = make_str("analyse"); }
51055108
|ANALYZE {$$ = make_str("analyze"); }
5106-
|AND{$$ = make_str("and"); }
51075109
|ANY{$$ = make_str("any"); }
51085110
|ASC{$$ = make_str("asc"); }
51095111
|BETWEEN {$$ = make_str("between"); }
@@ -5198,7 +5200,6 @@ ECPGColLabel: ECPGColId{ $$ = $1; }
51985200
|TABLE{$$ = make_str("table"); }
51995201
|THEN {$$ = make_str("then"); }
52005202
|TO{$$ = make_str("to"); }
5201-
|TRAILING{$$ = make_str("trailing"); }
52025203
|TRANSACTION{$$ = make_str("transaction"); }
52035204
|TRIM{$$ = make_str("trim"); }
52045205
|TRUE_P{$$ = make_str("true"); }

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp