]> granicus.if.org Git - postgresql/commitdiff
Put back gistgettuple's check for backwards scan request.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 4 Dec 2010 03:43:01 +0000 (22:43 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 4 Dec 2010 03:43:01 +0000 (22:43 -0500)
On reflection it's a bad idea for the KNNGIST patch to have removed that.
We don't want it silently returning incorrect answers.

src/backend/access/gist/gistget.c

index f0418a08af20e86456b087dfdac1767baf110e3b..afff55c78813d6b77f65da61d7ebd2e4463252a4 100644 (file)
@@ -459,8 +459,12 @@ Datum
 gistgettuple(PG_FUNCTION_ARGS)
 {
        IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
+       ScanDirection dir = (ScanDirection) PG_GETARG_INT32(1);
        GISTScanOpaque so = (GISTScanOpaque) scan->opaque;
 
+       if (dir != ForwardScanDirection)
+               elog(ERROR, "GiST only supports forward scan direction");
+
        if (!so->qual_ok)
                PG_RETURN_BOOL(false);