diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-05-23 15:22:25 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-05-23 15:22:25 -0400 |
commit | 821b821a2421beaa58225ff000833df69fb962c5 (patch) | |
tree | a21b7bfa9eb85a1dad9a9cc2549e67508b3f3c15 /src/backend/access/gist/gistscan.c | |
parent | 284bef297733e553c73f1c858e0ce1532f754d18 (diff) | |
download | postgresql-821b821a2421beaa58225ff000833df69fb962c5.tar.gz postgresql-821b821a2421beaa58225ff000833df69fb962c5.zip |
Still more fixes for lossy-GiST-distance-functions patch.
Fix confusion in documentation, substantial memory leakage if float8 or
float4 are pass-by-reference, and assorted comments that were obsoleted
by commit 98edd617f3b62a02cb2df9b418fcc4ece45c7ec0.
Diffstat (limited to 'src/backend/access/gist/gistscan.c')
-rw-r--r-- | src/backend/access/gist/gistscan.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c index d0fea2b86ce..beb402357c0 100644 --- a/src/backend/access/gist/gistscan.c +++ b/src/backend/access/gist/gistscan.c @@ -88,8 +88,9 @@ gistbeginscan(PG_FUNCTION_ARGS) so->qual_ok = true; /* in case there are zero keys */ if (scan->numberOfOrderBys > 0) { - scan->xs_orderbyvals = palloc(sizeof(Datum) * scan->numberOfOrderBys); + scan->xs_orderbyvals = palloc0(sizeof(Datum) * scan->numberOfOrderBys); scan->xs_orderbynulls = palloc(sizeof(bool) * scan->numberOfOrderBys); + memset(scan->xs_orderbynulls, true, sizeof(bool) * scan->numberOfOrderBys); } scan->opaque = so; @@ -284,6 +285,8 @@ gistrescan(PG_FUNCTION_ARGS) GIST_DISTANCE_PROC, skey->sk_attno, RelationGetRelationName(scan->indexRelation)); + fmgr_info_copy(&(skey->sk_func), finfo, so->giststate->scanCxt); + /* * Look up the datatype returned by the original ordering operator. * GiST always uses a float8 for the distance function, but the @@ -297,7 +300,6 @@ gistrescan(PG_FUNCTION_ARGS) * first time. */ so->orderByTypes[i] = get_func_rettype(skey->sk_func.fn_oid); - fmgr_info_copy(&(skey->sk_func), finfo, so->giststate->scanCxt); /* Restore prior fn_extra pointers, if not first time */ if (!first_time) |