Re: gist index build produces corrupt result on

From: Eric Davies <eric(at)barrodale(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: gist index build produces corrupt result on
Date: 2004-03-04 21:31:50
Message-ID: 5.2.1.1.0.20040304124638.011502d0@marilyn.barrodale.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


At 10:28 PM 3/3/2004, Tom Lane wrote:
>Eric Davies <eric(at)barrodale(dot)com> writes:
> > We've looked at the contrib/cube code, but it's also a variable length
> > parameter, and it uses a very different parameter passing mechanism.
>
>Different how? I have a hard-to-pin-down intuition that your problem is

the parameter passing mechanism used by Postgis (and our 5D box) is to
pass a FunctionCallInfoData structure, via a PG_FUNCTION_ARGS macro.
The Postgis penalty function starts with:
/*
** The GiST Penalty method for boxes
** As in the R-tree paper, we use change in area as our penalty metric
*/
PG_FUNCTION_INFO_V1(gbox_penalty);
Datum gbox_penalty(PG_FUNCTION_ARGS)
{
GISTENTRY *origentry = (GISTENTRY *) PG_GETARG_POINTER(0);

the cube code appears to pass each argument separately, as one would
normally do with a
C program. Ie, the g_cube_penalty function starts with:
/*
** The GiST Penalty method for boxes
** As in the R-tree paper, we use change in area as our penalty metric
*/
float *
g_cube_penalty(GISTENTRY *origentry, GISTENTRY *newentry, float *result)
{
NDBOX *ud;
double tmp1,

Again, the postgis code seems to work fine with GiST indexes, so I would
rule out the argument passing mechanism as being of influence.

>closely associated with this issue, but without details it's impossible
>to say more. IIRC there were once assumptions in rtree and/or gist
>about the indexable datatype being pass-by-ref and/or varlena, and I'm
>not sure how much of that has been fixed.
>
>This seems a bit far afield for pgsql-general, however. I would
>suggest offering more details on -hackers. If you could post your code
>for people to play with, you'd likely get answers pretty quickly.

I figured likewise, but the etiquete for the postgresql.org group required
I try the more general group first. :-).
I'll give that a shot now.

> regards, tom lane

**********************************************
Eric Davies, M.Sc.
Barrodale Computing Services Ltd.
Tel: (250) 472-4372 Fax: (250) 472-4373
Web: http://www.barrodale.com
Email: eric(at)barrodale(dot)com
**********************************************
Mailing Address:
P.O. Box 3075 STN CSC
Victoria BC Canada V8W 3W2

Shipping Address:
Hut R, McKenzie Avenue
University of Victoria
Victoria BC Canada V8W 3W2
**********************************************

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2004-03-04 22:38:27 Re: REFERENCES error message complaint, suggestion
Previous Message Uwe C. Schroeder 2004-03-04 21:27:54 Re: REFERENCES error message complaint, suggestion