pcouderc has asked for the wisdom of the Perl Monks concerning the following question:

I am lost in a problem that could be more PostgreSQL than perl or DBI, but there are some wise men here :-)
My code (under mod-perl and Apache):
print STDERR "printit:($user, $newpasswd, $full_name, $email, $usernou +s)\n"; my $sth = $dbh->prepare("INSERT INTO crmusers (crmuser, passwd, full_n +ame, email, usernous) VALUES (?,?,?,?,?);"); $sth->execute($user, $newpasswd, $full_name, $email, $usernous);
gives me on STDERR:
printit:(lsil, hat , Luc SIL, lsil@tol.fr, 1) DBD::Pg::st execute failed: ERROR: Attribute 'hat' not found at ...

What am I doing wrong?
Thank you in advance.
Pierre Couderc

Replies are listed 'Best First'.
Re: Lost with DBI in postgresql
by dbwiz (Curate) on Oct 09, 2003 at 10:14 UTC

    It looks like one of your parameters is not being quoted.

    Use DBI->trace(2) before your prepare statement to get the query that is being passed to the DBMS.

    See Before asking a database related question ... for a simple example of how to use trace.

    If the problem is that your placeholder mechanism is not acting correctly, try quoting the offending parameter explicitly.

Re: Lost with DBI in postgresql
by Anonymous Monk on Oct 09, 2003 at 10:04 UTC
    Please post DDL so that we don't have to guess your database schema.
Re: Lost with DBI in postgresql
by jZed (Prior) on Oct 10, 2003 at 01:06 UTC
    It may be as simple as removing the extra semi-colon in your prepare statement (the one inside the double quotes doesn't belong there). If that's not it, you'll have to show us more because the rest of the code looks fine.