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

Commitaebeb47

Browse files
committed
Remove vestigial resolveUnknown arguments from transformSortClause etc.
There's really no situation where we don't want these unknown-to-textconversions to happen. The alternative is failure anyway, and the onecaller that was passing "false" did so only because it expected thecase could not arise. Might as well simplify the code.Discussion:https://postgr.es/m/CAH2L28uwwbL9HUM-WR=hromW1Cvamkn7O-g8fPY2m=_7muJ0oA@mail.gmail.com
1 parent87ecf2d commitaebeb47

File tree

4 files changed

+12
-37
lines changed

4 files changed

+12
-37
lines changed

‎src/backend/parser/analyze.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,6 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
12321232
stmt->sortClause,
12331233
&qry->targetList,
12341234
EXPR_KIND_ORDER_BY,
1235-
true/* fix unknowns */ ,
12361235
false/* allow SQL92 rules */ );
12371236

12381237
qry->groupClause=transformGroupClause(pstate,
@@ -1512,7 +1511,6 @@ transformValuesClause(ParseState *pstate, SelectStmt *stmt)
15121511
stmt->sortClause,
15131512
&qry->targetList,
15141513
EXPR_KIND_ORDER_BY,
1515-
true/* fix unknowns */ ,
15161514
false/* allow SQL92 rules */ );
15171515

15181516
qry->limitOffset=transformLimitClause(pstate,stmt->limitOffset,
@@ -1736,7 +1734,6 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
17361734
sortClause,
17371735
&qry->targetList,
17381736
EXPR_KIND_ORDER_BY,
1739-
false/* no unknowns expected */ ,
17401737
false/* allow SQL92 rules */ );
17411738

17421739
/* restore namespace, remove jrte from rtable */

‎src/backend/parser/parse_agg.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ transformAggregateCall(ParseState *pstate, Aggref *agg,
155155
tlist=lappend(tlist,tle);
156156

157157
torder=addTargetToSortList(pstate,tle,
158-
torder,tlist,sortby,
159-
true/* fix unknowns */ );
158+
torder,tlist,sortby);
160159
}
161160

162161
/* Never any DISTINCT in an ordered-set agg */
@@ -196,7 +195,6 @@ transformAggregateCall(ParseState *pstate, Aggref *agg,
196195
aggorder,
197196
&tlist,
198197
EXPR_KIND_ORDER_BY,
199-
true/* fix unknowns */ ,
200198
true/* force SQL99 rules */ );
201199

202200
/*

‎src/backend/parser/parse_clause.c

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ static int get_matching_location(int sortgroupref,
8989
staticList*resolve_unique_index_expr(ParseState*pstate,InferClause*infer,
9090
RelationheapRel);
9191
staticList*addTargetToGroupList(ParseState*pstate,TargetEntry*tle,
92-
List*grouplist,List*targetlist,intlocation,
93-
boolresolveUnknown);
92+
List*grouplist,List*targetlist,intlocation);
9493
staticWindowClause*findWindowClause(List*wclist,constchar*name);
9594
staticNode*transformFrameOffset(ParseState*pstate,intframeOptions,
9695
Node*clause);
@@ -2011,8 +2010,7 @@ transformGroupClauseExpr(List **flatresult, Bitmapset *seen_local,
20112010
if (!found)
20122011
*flatresult=addTargetToGroupList(pstate,tle,
20132012
*flatresult,*targetlist,
2014-
exprLocation(gexpr),
2015-
true);
2013+
exprLocation(gexpr));
20162014

20172015
/*
20182016
* _something_ must have assigned us a sortgroupref by now...
@@ -2300,7 +2298,6 @@ transformSortClause(ParseState *pstate,
23002298
List*orderlist,
23012299
List**targetlist,
23022300
ParseExprKindexprKind,
2303-
boolresolveUnknown,
23042301
booluseSQL99)
23052302
{
23062303
List*sortlist=NIL;
@@ -2319,8 +2316,7 @@ transformSortClause(ParseState *pstate,
23192316
targetlist,exprKind);
23202317

23212318
sortlist=addTargetToSortList(pstate,tle,
2322-
sortlist,*targetlist,sortby,
2323-
resolveUnknown);
2319+
sortlist,*targetlist,sortby);
23242320
}
23252321

23262322
returnsortlist;
@@ -2382,7 +2378,6 @@ transformWindowDefinitions(ParseState *pstate,
23822378
windef->orderClause,
23832379
targetlist,
23842380
EXPR_KIND_WINDOW_ORDER,
2385-
true/* fix unknowns */ ,
23862381
true/* force SQL99 rules */ );
23872382
partitionClause=transformGroupClause(pstate,
23882383
windef->partitionClause,
@@ -2553,8 +2548,7 @@ transformDistinctClause(ParseState *pstate,
25532548
continue;/* ignore junk */
25542549
result=addTargetToGroupList(pstate,tle,
25552550
result,*targetlist,
2556-
exprLocation((Node*)tle->expr),
2557-
true);
2551+
exprLocation((Node*)tle->expr));
25582552
}
25592553

25602554
/*
@@ -2671,8 +2665,7 @@ transformDistinctOnClause(ParseState *pstate, List *distinctlist,
26712665
parser_errposition(pstate,exprLocation(dexpr))));
26722666
result=addTargetToGroupList(pstate,tle,
26732667
result,*targetlist,
2674-
exprLocation(dexpr),
2675-
true);
2668+
exprLocation(dexpr));
26762669
}
26772670

26782671
/*
@@ -2906,17 +2899,11 @@ transformOnConflictArbiter(ParseState *pstate,
29062899
*list, add it to the end of the list, using the given sort ordering
29072900
*info.
29082901
*
2909-
* If resolveUnknown is TRUE, convert TLEs of type UNKNOWN to TEXT. If not,
2910-
* do nothing (which implies the search for a sort operator will fail).
2911-
* pstate should be provided if resolveUnknown is TRUE, but can be NULL
2912-
* otherwise.
2913-
*
29142902
* Returns the updated SortGroupClause list.
29152903
*/
29162904
List*
29172905
addTargetToSortList(ParseState*pstate,TargetEntry*tle,
2918-
List*sortlist,List*targetlist,SortBy*sortby,
2919-
boolresolveUnknown)
2906+
List*sortlist,List*targetlist,SortBy*sortby)
29202907
{
29212908
Oidrestype=exprType((Node*)tle->expr);
29222909
Oidsortop;
@@ -2927,7 +2914,7 @@ addTargetToSortList(ParseState *pstate, TargetEntry *tle,
29272914
ParseCallbackStatepcbstate;
29282915

29292916
/* if tlist item is an UNKNOWN literal, change it to TEXT */
2930-
if (restype==UNKNOWNOID&&resolveUnknown)
2917+
if (restype==UNKNOWNOID)
29312918
{
29322919
tle->expr= (Expr*)coerce_type(pstate, (Node*)tle->expr,
29332920
restype,TEXTOID,-1,
@@ -3055,22 +3042,16 @@ addTargetToSortList(ParseState *pstate, TargetEntry *tle,
30553042
* to a SELECT item that matches the GROUP BY item; it'd be pretty confusing
30563043
* to report such a location.
30573044
*
3058-
* If resolveUnknown is TRUE, convert TLEs of type UNKNOWN to TEXT. If not,
3059-
* do nothing (which implies the search for an equality operator will fail).
3060-
* pstate should be provided if resolveUnknown is TRUE, but can be NULL
3061-
* otherwise.
3062-
*
30633045
* Returns the updated SortGroupClause list.
30643046
*/
30653047
staticList*
30663048
addTargetToGroupList(ParseState*pstate,TargetEntry*tle,
3067-
List*grouplist,List*targetlist,intlocation,
3068-
boolresolveUnknown)
3049+
List*grouplist,List*targetlist,intlocation)
30693050
{
30703051
Oidrestype=exprType((Node*)tle->expr);
30713052

30723053
/* if tlist item is an UNKNOWN literal, change it to TEXT */
3073-
if (restype==UNKNOWNOID&&resolveUnknown)
3054+
if (restype==UNKNOWNOID)
30743055
{
30753056
tle->expr= (Expr*)coerce_type(pstate, (Node*)tle->expr,
30763057
restype,TEXTOID,-1,

‎src/include/parser/parse_clause.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extern List *transformGroupClause(ParseState *pstate, List *grouplist,
3131
ParseExprKindexprKind,booluseSQL99);
3232
externList*transformSortClause(ParseState*pstate,List*orderlist,
3333
List**targetlist,ParseExprKindexprKind,
34-
boolresolveUnknown,booluseSQL99);
34+
booluseSQL99);
3535

3636
externList*transformWindowDefinitions(ParseState*pstate,
3737
List*windowdefs,
@@ -47,8 +47,7 @@ extern void transformOnConflictArbiter(ParseState *pstate,
4747
Oid*constraint);
4848

4949
externList*addTargetToSortList(ParseState*pstate,TargetEntry*tle,
50-
List*sortlist,List*targetlist,SortBy*sortby,
51-
boolresolveUnknown);
50+
List*sortlist,List*targetlist,SortBy*sortby);
5251
externIndexassignSortGroupRef(TargetEntry*tle,List*tlist);
5352
externbooltargetIsInSortList(TargetEntry*tle,Oidsortop,List*sortList);
5453

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp