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

Commitb486e7f

Browse files
committed
Fix oversight in construction of sort/unique plans for UniquePaths.
If the original IN operator is cross-type, for example int8 = int4,we need to use int4 < int4 to sort the inner data and int4 = int4to unique-ify it. We got the first part of that right, but tried touse the original IN operator for the equality checks. Per bug #5472from Vlad Romascanu.Backpatch to 8.4, where the bug was introduced by the patch that unifiedSortClause and GroupClause. I was able to take out a whole lot of on-the-flycalls of get_equality_op_for_ordering_op(), but failed to realize thatI needed to put one back in right here :-(
1 parent2925953 commitb486e7f

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.274 2010/03/28 22:59:32 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.275 2010/05/25 17:44:41 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -784,20 +784,34 @@ create_unique_plan(PlannerInfo *root, UniquePath *best_path)
784784
{
785785
Oidin_oper=lfirst_oid(l);
786786
Oidsortop;
787+
Oideqop;
787788
TargetEntry*tle;
788789
SortGroupClause*sortcl;
789790

790791
sortop=get_ordering_op_for_equality_op(in_oper, false);
791792
if (!OidIsValid(sortop))/* shouldn't happen */
792793
elog(ERROR,"could not find ordering operator for equality operator %u",
793794
in_oper);
795+
796+
/*
797+
* The Unique node will need equality operators. Normally these
798+
* are the same as the IN clause operators, but if those are
799+
* cross-type operators then the equality operators are the ones
800+
* for the IN clause operators' RHS datatype.
801+
*/
802+
eqop=get_equality_op_for_ordering_op(sortop,NULL);
803+
if (!OidIsValid(eqop))/* shouldn't happen */
804+
elog(ERROR,"could not find equality operator for ordering operator %u",
805+
sortop);
806+
794807
tle=get_tle_by_resno(subplan->targetlist,
795808
groupColIdx[groupColPos]);
796809
Assert(tle!=NULL);
810+
797811
sortcl=makeNode(SortGroupClause);
798812
sortcl->tleSortGroupRef=assignSortGroupRef(tle,
799813
subplan->targetlist);
800-
sortcl->eqop=in_oper;
814+
sortcl->eqop=eqop;
801815
sortcl->sortop=sortop;
802816
sortcl->nulls_first= false;
803817
sortList=lappend(sortList,sortcl);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp