in reply to Re: mysql and postgresql gotchas and tips
in thread mysql and postgresql gotchas and tips

Yupski. I tend to find that PostgreSQL comes back with less than useful error messages sometimes, so if you aren't using placeholders (I did find one case where I couldn't) you should be doing a:

my $sql = "INSERT INTO $table VALUES ...."; print STDERR "About to execute the sql statement $sql\n" if $debug; my $sth = prepare($sql); ...etc...

That's pretty obvious but it wasn't instinctive to me until about halfway through my database program.

____________________
Jeremy
I didn't believe in evil until I dated it.

Replies are listed 'Best First'.
Re: Re: Re: mysql and postgresql gotchas and tips
by Aighearach (Initiate) on Aug 06, 2001 at 01:57 UTC
    Note that interpolating the sql first becomes exactly the same as the original, in that you need to use quote again.

    I'm curious what the case where you can't bind the value is? The worst I've hit was having to use :1 :2 instead of ? ?
    --
    Snazzy tagline here

      Exactly as in my example above, you can't use placeholders for table names. So I couldn't loop over multiple tables at the same time.

      I probably shouldn't have been doing that, but I had to, so I had to find a way.

      ____________________
      Jeremy
      I didn't believe in evil until I dated it.