Skip to content

Commit 6b21cfb

Browse files
committed
add check for canOrdering. Fix for current opclasses follows
1 parent 7f98b9d commit 6b21cfb

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

Diff for: src/rumscan.c

+25-18
Original file line numberDiff line numberDiff line change
@@ -164,30 +164,37 @@ rumFillScanKey(RumScanOpaque so, OffsetNumber attnum,
164164
key->addInfoKeys = NULL;
165165
key->addInfoNKeys = 0;
166166

167-
if (key->orderBy && key->attnum == rumstate->attrnAttachColumn)
167+
if (key->orderBy)
168168
{
169-
if (nQueryValues != 1)
170-
elog(ERROR, "extractQuery should return only one value for ordering");
171-
if (rumstate->canOuterOrdering[attnum - 1] == false)
172-
elog(ERROR, "doesn't support ordering as additional info");
173-
if (rumstate->origTupdesc->attrs[rumstate->attrnAttachColumn - 1]->attbyval == false)
174-
elog(ERROR, "doesn't support order by over pass-by-reference column");
169+
if (key->attnum == rumstate->attrnAttachColumn)
170+
{
171+
if (nQueryValues != 1)
172+
elog(ERROR, "extractQuery should return only one value for ordering");
173+
if (rumstate->canOuterOrdering[attnum - 1] == false)
174+
elog(ERROR, "doesn't support ordering as additional info");
175+
if (rumstate->origTupdesc->attrs[rumstate->attrnAttachColumn - 1]->attbyval == false)
176+
elog(ERROR, "doesn't support order by over pass-by-reference column");
175177

176-
key->useAddToColumn = true;
177-
key->attnum = rumstate->attrnAddToColumn;
178-
key->nentries = 0;
179-
key->nuserentries = 0;
178+
key->useAddToColumn = true;
179+
key->attnum = rumstate->attrnAddToColumn;
180+
key->nentries = 0;
181+
key->nuserentries = 0;
180182

181-
key->outerAddInfoIsNull = true;
183+
key->outerAddInfoIsNull = true;
182184

183-
key->scanEntry = NULL;
184-
key->entryRes = NULL;
185-
key->addInfo = NULL;
186-
key->addInfoIsNull = NULL;
185+
key->scanEntry = NULL;
186+
key->entryRes = NULL;
187+
key->addInfo = NULL;
188+
key->addInfoIsNull = NULL;
187189

188-
so->willSort = true;
190+
so->willSort = true;
189191

190-
return;
192+
return;
193+
}
194+
else if (rumstate->canOrdering[attnum - 1] == false)
195+
{
196+
elog(ERROR,"doesn't support ordering, check operator class definition");
197+
}
191198
}
192199

193200
key->nentries = nQueryValues;

0 commit comments

Comments
 (0)