From 55b59eda13a742f8af913734e22ecc8a21754414 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Thu, 26 Mar 2015 23:07:52 +0200 Subject: Fix GiST index-only scans for opclasses with different storage type. We cannot use the index's tuple descriptor directly to describe the index tuples returned in an index-only scan. That's because the index might use a different datatype for the values stored on disk than the type originally indexed. As long as they were both pass-by-ref, it worked, but will not work for pass-by-value types of different sizes. I noticed this as a crash when I started hacking a patch to add fetch methods to btree_gist. --- src/backend/access/gist/gistutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/backend/access/gist/gistutil.c') diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c index 1680251a18..bf9fbf30a8 100644 --- a/src/backend/access/gist/gistutil.c +++ b/src/backend/access/gist/gistutil.c @@ -657,7 +657,7 @@ gistFetchTuple(GISTSTATE *giststate, Relation r, IndexTuple tuple) } MemoryContextSwitchTo(oldcxt); - return index_form_tuple(giststate->tupdesc, fetchatt, isnull); + return index_form_tuple(giststate->fetchTupdesc, fetchatt, isnull); } float -- cgit v1.2.1