I'm trying to insert a geometry into a postgis enabled postgresql database, using a postgis function ST_GeomFromText.
The relevant SQL is: INSERT INTO mytable (description, mypoint) VALUES ('description', ST_GeomFromText('POINT(<int> <int>)', <int>); where <int> is an integer specifying point coordinates and SRID (Spatial Reference Id) respectively. I've tried the following code, but it fails. #!/usr/bin/perl -wT use DBI; use strict; my $srid = 4326; my $dbname = "test"; my $dbuser = "tim"; my $coord = 7653; my $dbh = DBI->connect("dbi:Pg:dbname=$dbname;host=127.0.0.1","$dbuser") or die "can't connect to the db: $!\n"; # The mygeom table has been set up for postgis point geometries... my @desc = qw/ desc1 next_desc point3 location4 /; my $sth = $dbh->prepare("INSERT INTO mygeom (description, mypoint) VALUES (?, ST_GeomFromText('POINT(? ?)', ?))"); my $params = $sth->{NUM_OF_PARAMS}; print "\nNumber of identified params: $params\n"; for (@desc){ $sth->bind_param(1, $_); $sth->bind_param(2, $coord); $sth->bind_param(3, $coord); $sth->execute(); } ******* $sth->{NUM_OF_PARAMS} reports 2 params. The error message is: Cannot bind unknown placeholder 3 (3) at ./postgis.load line 20. It would seem the two ?'s in the 'POINT(? ?)' argument to the ST_GeomFromText function are not being identified as placeholders. Any suggestions as to how I should approach this? Thanks, Tim Bowden