[postgis-devel] RE: getrelid && list_nth

Mark Cave-Ayland m.cave-ayland at webbased.co.uk
Wed Jun 9 02:29:27 PDT 2004


Hi strk,

> -----Original Message-----
> From: 'strk' [mailto:strk at keybit.net] 
> Sent: 09 June 2004 09:57
> To: Mark Cave-Ayland
> Cc: postgis-devel at postgis.refractions.net
> Subject: Re: getrelid && list_nth
> 
> 
> On Wed, Jun 09, 2004 at 09:39:26AM +0100, Mark Cave-Ayland wrote:
> > Hi strk,
> > 
> > > -----Original Message-----
> > > From: strk [mailto:strk at keybit.net]
> > > Sent: 08 June 2004 18:19
> > > To: Mark Cave-Ayland
> > > Cc: postgis-devel at postgis.refractions.net
> > > Subject: getrelid && list_nth
> > > 
> > > 
> > > Hello Mark,
> > > I was writing this to pgsql-hackers, but I've solved it
> > > so I turned it into a report.
> > > 
> > > Working on postgis selectivity function for type 'geometry'
> > > I've incurred in the following problem:
> > > 
> > > The getrelid() macro defined in parser/parsetree.h invokes the 
> > > rt_fetch() macro therein defined, which in turn invokes list_nth.
> > > 
> > > Now list_nth() is not a macro, and postgis
> > > is not linked to postgresql dynamic library, so
> > > it fails to load.
> > > 
> > > This worked until some months ago (PG was already
> > > versioned as 75dev).
> > 
> > FYI the List API has recently changed in PostgreSQL 7.5 which is 
> > probably why this has broken - please see the following links:
> > 
> > http://archives.postgresql.org/pgsql-patches/2004-05/msg00344.php
> > http://archives.postgresql.org/pgsql-patches/2004-05/msg00376.php
> > 
> > and the thread here:
> > 
> > http://archives.postgresql.org/pgsql-patches/2004-05/msg00500.php
> > 
> > 
> > > To fix this I've copied list_nth and list_nth_cell into
> > > postgis_estimate.c removing superflous ( I hope ) checks on 
> > > boundaries.
> > 
> > Yuck. I don't think we should be duplicating the PostgreSQL 
> list API 
> > just because the API has changed between versions. Any chance you 
> > could look at the posted patch and correct CVS so that this is not 
> > needed?
> 
> Do you mean the PGSQL List API change patch ?

Yes - I'm guessing that Dave must have borrowed the code from an
existing selectivity function either in the PostgreSQL core (probably
selfuncs.c!) or contrib/ so hopefully the diff will allow you can see
which changes need to be made. My guess from perusing the links above
would be that it is something simple like the macro name has been
changed.
 
> > BTW did you find that building large GiST indices crashes 
> PostgreSQL?
> 
> Nope. I haven't been playing with PG75 for a while.

:) Me neither. The GiST API has changed again which is what resulted in
my "super patch" to stop PostgreSQL crashing when building geometric
GiST indices.

> > Would any developers object if the "super patch" for 7.5 were to be 
> > applied to CVS? If no-one objects I'd like to apply it real soon....
> 
> I'll take a look at it.

Many thanks. It's actually a very simple patch but it also includes
Romi's fixes to get things to compile under Win32 MingW too. With this
patch applied, and the list API change done, you should find that CVS
should compile under 7.5 once again.


Cheers,

Mark.

---

Mark Cave-Ayland
Webbased Ltd.
Tamar Science Park
Derriford
Plymouth
PL6 8BX
England

Tel: +44 (0)1752 764445
Fax: +44 (0)1752 764446


This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender. You
should not copy it or use it for any purpose nor disclose or distribute
its contents to any other person.





More information about the postgis-devel mailing list