[Openstreetmap] Re: PostgreSQL perl script and GPS protocol question

Petter Reinholdtsen pere at hungry.com
Fri Dec 3 13:20:13 GMT 2004


[Petter Reinholdtsen]
> To avoid having to investigate how to get the Java program to store
> points into a database to work on my woody installation (kaffe
> didn't seem up for the job), I rewrote the collecting task in Perl.

I have run into problems when using perl to extract GPX files from the
large GPS point database, and finally tracked down the reason for
these problems:

The manual page for DBD::Pg, available from
<URL:http://search.cpan.org/~rudy/DBD-Pg-1.31/Pg.pm#Cursors>, states:

  Cursors
  -------

  Although PostgreSQL has a cursor concept, it has not been used in
  the current implementation. Cursors in PostgreSQL can only be used
  inside a transaction block. Because only one transaction block at a
  time is allowed, this would have implied the restriction, not to use
  any nested SELECT statements. Hence the execute method fetches all
  data at once into data structures located in the frontend
  application. This has to be considered when selecting large amounts
  of data!

When running 'select * from track order by time', the DBD/Perl scritp
tries to load the complete database into memory.  This is doomed to
fail, and does so.

I consider this to be a bug in DBD::Pg, but accept the design
decision.  I'm going to test if I can use cursors directly within the
DBD driver.  If this fail, I will have to change to another language.

JFYI.

Anyone know if the Python or C drivers uses cursors by default?




More information about the talk mailing list