Re: DBI && INSERT - Mailing list pgsql-general

From Gianni Ceccarelli
Subject Re: DBI && INSERT
Date
Msg-id 20200217161540.1a8d02e5@exelion
Whole thread Raw
In response to DBI && INSERT  (Matthias Apitz <guru@unixarea.de>)
List pgsql-general
On Mon, 17 Feb 2020 16:49:27 +0100
Matthias Apitz <guru@unixarea.de> wrote:
> I spend today some hours to nail down and insert problem into our
> database with DBI like:
> 
>    my $rc = $my_dbh->do($my_sqlstatement);
> 
> which returns 1 in $rc (which the following flow in our script took
> as an error).

The DBI docs say::

  $rows = $dbh->do($statement) or die $dbh->errstr;

so when ``do`` returns 1, it means it worked, not that it failed.

In particular:

    Returns the number of rows affected or "undef" on error. A return
    value of "-1" means the number of rows is not known, not
    applicable, or not available.

-- 
    Dakkar - <Mobilis in mobile>
    GPG public key fingerprint = A071 E618 DD2C 5901 9574
                                 6FE2 40EA 9883 7519 3F88
                        key id = 0x75193F88




pgsql-general by date:

Previous
From: Matthias Apitz
Date:
Subject: DBI && INSERT
Next
From: Jeremy Schneider
Date:
Subject: Re: PL/pgSQL question about EXCEPTION clause & corrupt records