Hello,

After I've upgraded to newest versions of DBI(1.46) and DBD::Pg (1.32), my
scripts started to fail while feeding arrays into stored procedures in 
postgresql base (v7.4.6). The (old working) code was something like

    $dbh-> selectrow_array("SELECT dummy(?)", {}, [ 1, 2, 3]);

where 'dummy' is a function accepting array of integers and returning a single
integer:

   CREATE OR REPLACE FUNCTION dummy(INTEGER[])
   RETURNS integer AS '
   DECLARE
   BEGIN RETURN 0; END;
   ' LANGUAGE 'plpgsql' CALLED ON NULL INPUT;

Now, the scripts fail with the following error: 

   DBD::Pg::st execute_array failed: ERROR:  array value must start with "{" or 
   dimension information

Then I've modified the script so it looks like this:

   my $sth = $dbh->prepare( "SELECT dummy(?)");
   $sth-> bind_param_array( 1, [1,2,3]);
   $sth-> execute_array({});

But the error message is still the same. Finally, I've grep'd the postgresql
source code and found the 'array value must start...' line in the array parsing
code there, and so my best guess is that there must be somethign broken in the
newer version of DBD::Pg, probably somewhere near the place the arrays are
encoded, but I'm not really sure. OTOH, the 'new' DBD::Pg is not that new,
dated 2004/02/25, so it looks that the problem is elsewhere...

Does anybody have a clue what's actually happening?

Thanks in advance,
    Dmitry Karasik


Reply via email to