I'm using the DBD::pg to work with my PostgreSQL server from my perl script. One of the columns in my database is using the Serial datatype to have the value auto incremented by Postgre. The way that I am currently working with it is by sending it a blank value

$compid = q[]

but that produces this error from Postgre

DBD::Pg::db do failed: ERROR: invalid input syntax for integer: "" at repairs.pl line 352, <> line 20. Error: could not insert data into database: ERROR: invalid input syntax for integer: "" at repairs.pl line 366 main::db_add_computer('probdesc', 'n/a', 'compid', '', 'custid', '000-000000', 'service', 'n/a', 'compsn', ...) called at repairs.pl line 280 main::print_form() called at repairs.pl line 106

Anyone know what I am doing wrong here? If not then I can try asking in the IRC channel for PostgreSQL


In reply to Working with Postgresql serial data type in Perl by vendion

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.