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

Commit012abeb

Browse files
committed
Remove the stub support we had for UNION JOIN; per discussion, this is
not likely ever to be implemented seeing it's been removed from SQL2003.This allows getting rid of the 'filter' version of yylex() that we had inparser.c, which should save at least a few microseconds in parsing.
1 parent48cf295 commit012abeb

File tree

14 files changed

+20
-158
lines changed

14 files changed

+20
-158
lines changed

‎src/backend/optimizer/path/clausesel.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.78 2006/03/05 15:58:28 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.79 2006/03/07 01:00:15 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -449,8 +449,6 @@ clause_selectivity(PlannerInfo *root,
449449
cacheable= true;
450450
break;
451451

452-
caseJOIN_UNION:
453-
/* unimplemented anyway... */
454452
caseJOIN_IN:
455453
caseJOIN_REVERSE_IN:
456454
caseJOIN_UNIQUE_OUTER:

‎src/backend/optimizer/plan/initsplan.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.115 2006/03/05 15:58:29 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.116 2006/03/07 01:00:15 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -363,18 +363,6 @@ deconstruct_recurse(PlannerInfo *root, Node *jtnode, bool below_outer_join,
363363
*qualscope=bms_union(leftids,rightids);
364364
nonnullable_rels=leftids;
365365
break;
366-
caseJOIN_UNION:
367-
368-
/*
369-
* This is where we fail if upper levels of planner haven't
370-
* rewritten UNION JOIN as an Append ...
371-
*/
372-
ereport(ERROR,
373-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
374-
errmsg("UNION JOIN is not implemented")));
375-
nonnullable_rels=NULL;/* keep compiler quiet */
376-
leftjoinlist=rightjoinlist=NIL;
377-
break;
378366
default:
379367
elog(ERROR,"unrecognized join type: %d",
380368
(int)j->jointype);

‎src/backend/optimizer/prep/prepjointree.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
* $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.36 2006/03/05 15:58:30 momjian Exp $
18+
* $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.37 2006/03/07 01:00:15 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -242,16 +242,6 @@ pull_up_subqueries(PlannerInfo *root, Node *jtnode,
242242
j->rarg=pull_up_subqueries(root,j->rarg,
243243
below_outer_join, false);
244244
break;
245-
caseJOIN_UNION:
246-
247-
/*
248-
* This is where we fail if upper levels of planner haven't
249-
* rewritten UNION JOIN as an Append ...
250-
*/
251-
ereport(ERROR,
252-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
253-
errmsg("UNION JOIN is not implemented")));
254-
break;
255245
default:
256246
elog(ERROR,"unrecognized join type: %d",
257247
(int)j->jointype);

‎src/backend/parser/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Makefile for parser
44
#
5-
# $PostgreSQL: pgsql/src/backend/parser/Makefile,v 1.42 2003/11/29 19:51:51 pgsql Exp $
5+
# $PostgreSQL: pgsql/src/backend/parser/Makefile,v 1.43 2006/03/07 01:00:17 tgl Exp $
66
#
77
#-------------------------------------------------------------------------
88

@@ -57,13 +57,12 @@ endif
5757

5858

5959
# Force these dependencies to be known even without dependency info built:
60-
61-
gram.okeywords.oparser.o:$(srcdir)/parse.h
60+
gram.okeywords.o:$(srcdir)/parse.h
6261

6362

6463
# gram.c, parse.h, and scan.c are in the distribution tarball, so they
6564
# are not cleaned here.
6665
clean:
6766
rm -f SUBSYS.o$(OBJS)
6867
# And the garbage that might have been left behind by partial build:
69-
@rm -f y.tab.c y.tab.h lex.yy.c
68+
@rm -f y.tab.h y.tab.c y.output lex.yy.c

‎src/backend/parser/gram.y

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.533 2006/03/05 15:58:32 momjian Exp $
14+
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.534 2006/03/07 01:00:16 tgl Exp $
1515
*
1616
* HISTORY
1717
* AUTHORDATEMAJOR EVENT
@@ -95,6 +95,7 @@ static void doNegateFloat(Value *v);
9595

9696
%}
9797

98+
%name-prefix="base_yy"
9899

99100
%union
100101
{
@@ -418,12 +419,6 @@ static void doNegateFloat(Value *v);
418419

419420
ZONE
420421

421-
/* The grammar thinks these are keywords, but they are not in the keywords.c
422-
* list and so can never be entered directly. The filter in parser.c
423-
* creates these tokens when required.
424-
*/
425-
%tokenUNIONJOIN
426-
427422
/* Special token types, not actually keywords - see the "lex" file*/
428423
%token<str>IDENTFCONSTSCONSTBCONSTXCONSTOp
429424
%token<ival>ICONSTPARAM
@@ -464,7 +459,7 @@ static void doNegateFloat(Value *v);
464459
* They wouldn't be given a precedence at all, were it not that we need
465460
* left-associativity among the JOIN rules themselves.
466461
*/
467-
%leftJOINUNIONJOINCROSSLEFTFULLRIGHTINNER_PNATURAL
462+
%leftJOINCROSSLEFTFULLRIGHTINNER_PNATURAL
468463
%%
469464

470465
/*
@@ -5774,20 +5769,6 @@ joined_table:
57745769
n->quals =NULL;
57755770
$$ = n;
57765771
}
5777-
| table_ref UNIONJOIN table_ref
5778-
{
5779-
/* UNION JOIN is made into 1 token to avoid shift/reduce
5780-
* conflict against regular UNION keyword.
5781-
*/
5782-
JoinExpr *n = makeNode(JoinExpr);
5783-
n->jointype = JOIN_UNION;
5784-
n->isNatural =FALSE;
5785-
n->larg =$1;
5786-
n->rarg =$3;
5787-
n->using = NIL;
5788-
n->quals =NULL;
5789-
$$ = n;
5790-
}
57915772
| table_ref join_type JOIN table_ref join_qual
57925773
{
57935774
JoinExpr *n = makeNode(JoinExpr);

‎src/backend/parser/parser.c

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,26 @@
77
* (since we need to be able to do basic parsing even while inside an
88
* aborted transaction). Therefore, the data structures returned by
99
* the grammar are "raw" parsetrees that still need to be analyzed by
10-
*parse_analyze.
10+
*analyze.c and related files.
1111
*
1212
*
1313
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
1414
* Portions Copyright (c) 1994, Regents of the University of California
1515
*
1616
* IDENTIFICATION
17-
* $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.64 2006/03/05 15:58:34 momjian Exp $
17+
* $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.65 2006/03/07 01:00:17 tgl Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
2121

2222
#include"postgres.h"
2323

24-
#include"nodes/parsenodes.h"
2524
#include"parser/gramparse.h"
26-
#include"parser/parse.h"
2725
#include"parser/parser.h"
28-
#include"parser/parse_expr.h"
2926

3027

3128
List*parsetree;/* result of parsing is left here */
3229

33-
staticintlookahead_token;/* one-token lookahead */
34-
staticboolhave_lookahead;/* lookahead_token set? */
35-
3630

3731
/*
3832
* raw_parser
@@ -46,12 +40,11 @@ raw_parser(const char *str)
4640
intyyresult;
4741

4842
parsetree=NIL;/* in case grammar forgets to set it */
49-
have_lookahead= false;
5043

5144
scanner_init(str);
5245
parser_init();
5346

54-
yyresult=yyparse();
47+
yyresult=base_yyparse();
5548

5649
scanner_finish();
5750

@@ -60,48 +53,3 @@ raw_parser(const char *str)
6053

6154
returnparsetree;
6255
}
63-
64-
65-
/*
66-
* Intermediate filter between parser and base lexer (base_yylex in scan.l).
67-
*
68-
* The filter is needed because in some cases SQL92 requires more than one
69-
* token lookahead. We reduce these cases to one-token lookahead by combining
70-
* tokens here, in order to keep the grammar LR(1).
71-
*
72-
* Using a filter is simpler than trying to recognize multiword tokens
73-
* directly in scan.l, because we'd have to allow for comments between the
74-
* words ...
75-
*/
76-
int
77-
yylex(void)
78-
{
79-
intcur_token;
80-
81-
/* Get next token --- we might already have it */
82-
if (have_lookahead)
83-
{
84-
cur_token=lookahead_token;
85-
have_lookahead= false;
86-
}
87-
else
88-
cur_token=base_yylex();
89-
90-
/* Do we need to look ahead for a possible multiword token? */
91-
switch (cur_token)
92-
{
93-
caseUNION:
94-
/* UNION JOIN must be reduced to a single UNIONJOIN token */
95-
lookahead_token=base_yylex();
96-
if (lookahead_token==JOIN)
97-
cur_token=UNIONJOIN;
98-
else
99-
have_lookahead= true;
100-
break;
101-
102-
default:
103-
break;
104-
}
105-
106-
returncur_token;
107-
}

‎src/backend/parser/scan.l

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* Portions Copyright (c) 1994, Regents of the University of California
2525
*
2626
* IDENTIFICATION
27-
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.131 2006/03/06 19:49:20 momjian Exp $
27+
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.132 2006/03/07 01:00:17 tgl Exp $
2828
*
2929
*-------------------------------------------------------------------------
3030
*/
@@ -45,8 +45,6 @@
4545
#undef fprintf
4646
#definefprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
4747

48-
extern YYSTYPE yylval;
49-
5048
staticintxcdepth =0;/* depth of nesting in slash-star comments*/
5149
staticchar *dolqstart;/* current $foo$ quote start string*/
5250

‎src/backend/utils/adt/ruleutils.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*back to source text
44
*
55
* IDENTIFICATION
6-
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.213 2006/01/26 17:08:19 tgl Exp $
6+
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.214 2006/03/07 01:00:17 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -4357,11 +4357,6 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context)
43574357
-PRETTYINDENT_JOIN,
43584358
PRETTYINDENT_JOIN,0);
43594359
break;
4360-
caseJOIN_UNION:
4361-
appendContextKeyword(context,"NATURAL UNION JOIN ",
4362-
-PRETTYINDENT_JOIN,
4363-
PRETTYINDENT_JOIN,0);
4364-
break;
43654360
default:
43664361
elog(ERROR,"unrecognized join type: %d",
43674362
(int)j->jointype);
@@ -4396,11 +4391,6 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context)
43964391
-PRETTYINDENT_JOIN,
43974392
PRETTYINDENT_JOIN,2);
43984393
break;
4399-
caseJOIN_UNION:
4400-
appendContextKeyword(context," UNION JOIN ",
4401-
-PRETTYINDENT_JOIN,
4402-
PRETTYINDENT_JOIN,2);
4403-
break;
44044394
default:
44054395
elog(ERROR,"unrecognized join type: %d",
44064396
(int)j->jointype);

‎src/include/nodes/nodes.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.183 2006/03/05 15:58:56 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.184 2006/03/07 01:00:18 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -457,13 +457,6 @@ typedef enum JoinType
457457
JOIN_FULL,/* pairs + unmatched outer + unmatched inner */
458458
JOIN_RIGHT,/* pairs + unmatched inner tuples */
459459

460-
/*
461-
* SQL92 considers UNION JOIN to be a kind of join, so list it here for
462-
* parser convenience, even though it's not implemented like a join in the
463-
* executor. (The planner must convert it to an Append plan.)
464-
*/
465-
JOIN_UNION,
466-
467460
/*
468461
* These are used for queries like WHERE foo IN (SELECT bar FROM ...).
469462
* Only JOIN_IN is actually implemented in the executor; the others are

‎src/include/parser/gramparse.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/parser/gramparse.h,v 1.32 2006/03/05 15:58:57 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/parser/gramparse.h,v 1.33 2006/03/07 01:00:18 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -18,18 +18,15 @@
1818
#include"nodes/parsenodes.h"
1919

2020

21-
/* from parser.c */
22-
externintyylex(void);
23-
2421
/* from scan.l */
2522
externvoidscanner_init(constchar*str);
2623
externvoidscanner_finish(void);
2724
externintbase_yylex(void);
28-
externvoidyyerror(constchar*message);
25+
externvoidbase_yyerror(constchar*message);
2926

3027
/* from gram.y */
3128
externvoidparser_init(void);
32-
externintyyparse(void);
29+
externintbase_yyparse(void);
3330
externList*SystemFuncName(char*name);
3431
externTypeName*SystemTypeName(char*name);
3532
externboolexprIsNullConstant(Node*arg);

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.320 2006/02/08 09:10:04 meskes Exp $*/
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.321 2006/03/07 01:00:19 tgl Exp $*/
22

33
/* Copyright comment*/
44
%{
@@ -426,12 +426,6 @@ add_additional_variables(char *name, bool insert)
426426
YEAR_P
427427
ZONE
428428

429-
/* The grammar thinks these are keywords, but they are not in the keywords.c
430-
* list and so can never be entered directly. The filter in parser.c
431-
* creates these tokens when required.
432-
*/
433-
%tokenUNIONJOIN
434-
435429
/* Special token types, not actually keywords - see the "lex" file*/
436430
%token<str>IDENTSCONSTOpCSTRINGCVARIABLECPP_LINEIPBCONSTXCONSTDOLCONST
437431
%token<ival>ICONSTPARAM
@@ -465,7 +459,7 @@ add_additional_variables(char *name, bool insert)
465459
%left'('')'
466460
%leftTYPECAST
467461
%left'.'
468-
%leftJOINUNIONJOINCROSSLEFTFULLRIGHTINNER_PNATURAL
462+
%leftJOINCROSSLEFTFULLRIGHTINNER_PNATURAL
469463

470464
%type<str>IconstFconstSconstTransactionStmtCreateStmtRoleId
471465
%type<str>CreateAsElementOptCreateAsCreateAsListCreateAsStmt
@@ -3391,8 +3385,6 @@ joined_table: '(' joined_table ')'
33913385
{$$ = cat_str(3, make_str("("),$2, make_str(")")); }
33923386
|table_refCROSSJOINtable_ref
33933387
{$$ = cat_str(3,$1, make_str("cross join"),$4); }
3394-
|table_refUNIONJOINtable_ref
3395-
{$$ = cat_str(3,$1, make_str("unionjoin"),$3); }
33963388
|table_refjoin_typeJOINtable_refjoin_qual
33973389
{$$ = cat_str(5,$1,$2, make_str("join"),$4,$5); }
33983390
|table_refJOINtable_refjoin_qual

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp