libpq problem with inserts - Mailing list pgsql-general

From Kevin Sorensen
Subject libpq problem with inserts
Date
Msg-id LNBBLFDKDBGPNAIBMDLNIEOPCKAA.kevin@pcxcess.com
Whole thread Raw
Responses Re: libpq problem with inserts  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
i have been reading most of the night trying to figure this out, and it
may be just because i am tired that i missed something but here is the
problem i am having:

i am running a loop inserting several items into a table something kind
of similar as below, but more complicated. However, when i print the sql
strings, everything prints out and works fine, however, when i try to
insert them into the database, only some of them get inserted. i can say
that i am quite unfamiliar with libpq, but this one perl script is about
the only thing i have done with it, and it is for a cronjob. usually i use
php and have no problems. anyways, if anyone knows the answer or any ideas,
i would appreciated it.

postgresql v.7.0.0
rh linux 6.1

while ($i < 50) {
$blah1 = PQexec($conn, "INSERT INTO invoice_desc VALUES ('$val1', '$val2',
'$val3', '$val4');");
$blah2 = PQexec($conn, "INSERT INTO invoice_desc VALUES ('$val11', '$val12',
'$val13', '$val14');");
$blah3 = PQexec($conn, "INSERT INTO invoice_desc VALUES ('$val21', '$val22',
'$val23', '$val24');");
$blah4 = PQexec($conn, "INSERT INTO invoice_desc VALUES ('$val31', '$val32',
'$val33', '$val34');");
$i++;
}

my only guess is that some of the inserts are taking longer or something,
and it is just dropping them or something.


pgsql-general by date:

Previous
From: Jan Wieck
Date:
Subject: Re: Materialized views in PostgreSQL?
Next
From: Tom Lane
Date:
Subject: Re: libpq problem with inserts