Thread: Problems on inserting with DBD::Pg

Problems on inserting with DBD::Pg

From
"Simon Crute"
Date:
Hi,
  I'm using perl 5.6, DBD::Pg with Peter's patch to enable full error
messages (Thanks !!) and I'm having a problem doing an insert. Here's the
extracts of code.


here's the prepare of the statement handle.

$sth_insert = $dbh->prepare("INSERT INTO PEOPLE (userid, title, fname,
sname, email, add_house, add_street, add_area, add_town, add_county,
dd_country, add_code, tel1, tel2, fax, sms, preferred_contact,
registered_date, last_logon_date)
      VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,SYSDATE,SYSDATE)")
or die "<p> unable to prepare statement /n<p> $DBI::errst<p></body></html>";

then later the execute


$sth_insert->execute($userid,$title,$forename,$surname,$email,$house,$street
,$blankadd,$town,$county,$country,
$pcode,$tel1,$tel2,$fax,$sms,$preferred_contact) or die "<p> unable to
insert statement /n<p> $DBI::errstr<p></body></html>";

The error message reported is

[Tue May  8 20:25:27 2001] newuser.plx: DBD::Pg::st execute failed: ERROR:
parser: parse error at or near "ail" at /......./cgi/newuser.plx line 161.


Now, line 161 is the execute line. The only occurrences of "ail" (without
the quotes) anywhere near that line is in $email.

Anyone any ideas why it's failing there ? (the basic code worked when we
were using DBD::Oracle, all we've changed is the connect and dbh->prepare
code)

Thanks.




(full versions.
Perl 5.6
Redhat 6.2 based system (2.2.14-5.0)
postgres 7.1
DBD::Pg .98 + patch
DBI 1.14
)





Re: Problems on inserting with DBD::Pg

From
Tom Lane
Date:
"Simon Crute" <simon-news@nospam.geordie.demon.co.uk> writes:
> The error message reported is
> [Tue May  8 20:25:27 2001] newuser.plx: DBD::Pg::st execute failed: ERROR:
> parser: parse error at or near "ail" at /......./cgi/newuser.plx line 161.

Suggested approach to problems like this: turn on query logging at the
postmaster, so you can see exactly what query string is being
constructed and sent to the server.  Then you can usually work out what
went wrong.

            regards, tom lane