Esteemed Monks,

I wrote a Perl program wich uses PostgreSQL. This program was running well for months until yesterday, when my SysAdmin upgraded the DBD::Pg module for the current version (1.40).

Now, where I have

my $sql = " LOCK TABLE tabreserves IN SHARE MODE; SELECT tabreserves.date, tabreserves.hour_i, tabreserves.hour_e, tabreserves.idreserve, tabreserves.fk_idfield, tabfields.imped, tabfields.design FROM tabreserves LEFT JOIN tabfields ON tabfields.idfield = tabreserves.fk_idfield WHERE date = ? AND (hour_i < ? AND hour_e > ?) AND (fk_idfield = ? OR ? = ANY (imped)) LIMIT 1 ";
Raises 2 errors:

1st

DBD::Pg::st execute failed: ERROR: cannot insert multiple commands in +to a prepared statement

If I delete the first line LOCK TABLE tabreserves IN SHARE MODE;, raises another error.

2nd

DBD::Pg::st execute failed: ERROR: column "hour_i" is of type integer + but expression is of type character varying HINT: You will need to rewrite or cast the expression.

Needless to say that I have _many_ statements wich uses the same structure - e.g. multiple commands in a prepared statement and not casting expressions, since that wasn't mandatory before.

When we (me and the sysadmin) saw the errors we thought: "well... time to upgrade to PostgreSQL 8!". We were using 7.4. We did the upgrade. But the errors persist.

What am I missing here? Do I really need to cast expressions? and why can't I use multiple statements now?

Thanks,
Miguel


In reply to Need help with DBD::Pg by Miguel

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.