Postgresql questions

From Visual Basic to GNU C, this is the place to talk programming.

Moderators: SecretSquirrel, just brew it!

Postgresql questions

Postposted on Mon Dec 13, 2010 4:19 pm

Any gerbils have experience with postgres 8.4? We started using it for the spatial support, and now that we've gotten down to brass tacks we have hit some roadblocks. Two of the big problems we face are:
1. how do we set up prepared statements with spatial primitives? For instance, we are using libpq and it just hates it when we try to parametrize a spatial type, like setting up a prepared SQL command with a clause "where position <@ box'(($1,$2),($3,$4))';" (where position is a point type) It can't seem to resolve the operator. When we form the SQL as a text string and send it off (ie, not a prepared statement) everything works fine.
2. Our bigger problem is that we have a table with x,y positions of an object as points, and want to make a path out of it (so we can check to see if the path crosses a boundary, for instance). The part of the query which creates the path really eludes me - there should be some way to do a subselect and get the list of points, and have psql construct the path out of that, no? I have been trying things like "path(select position from objects where object_id=1)" but it doesn't like that.

Any insights?
Gerbil Elite
Posts: 604
Joined: Mon Apr 21, 2003 10:02 pm
Location: Philly

Return to Developer's Den

Who is online

Users browsing this forum: No registered users and 1 guest