Strange stuff with fetch

From: Maarten Boekhold <maartenb(at)dutepp0(dot)et(dot)tudelft(dot)nl>
To: pgsql-general(at)postgresql(dot)org
Subject: Strange stuff with fetch
Date: 1998-06-17 08:23:58
Message-ID: Pine.SUN.3.91.980617101513.24711B-100000@dutepp0.et.tudelft.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I have a pice of code which does basiccaly this:

$query = "fetch in T";
while (($res = PQexec($PG_CONN, $query)) &&
($PGRES_TUPLES_OK == PQresultStatus($res)) &&
(PQntuples($res) == 1)) {

do_stuff();
PQclear($res);
}

As you see I'm still using the old perl-interface :).

Now, this worked splendidly at home. No problems whatsoever. At home I
have 6.3.2. Now I wanted to use the same piece of code in the production
environment (PG_VERSION contains 6.1, but I think it's really 6.2). The
damned thing fails.

But it's not like it doesn't run. It run's, only after fetching 3765
rows, PQresultStatus() returns 0, which is PGRES_EMPTY_QUERY.

If I do the sme things in psql (begin; declare T cursor...; ...; fetch in
T), I have no trouble at all 'walking by' this row.

And the damned thing is that I can't even test for this special case
(PGRES_EMPTY_QUERY) and then continue, cos it's considered an error, and
all queries are ignored till the end of the transaction.

Anybody knows what's going on here?

Maarten

_____________________________________________________________________________
| TU Delft, The Netherlands, Faculty of Information Technology and Systems |
| Department of Electrical Engineering |
| Computer Architecture and Digital Technique section |
| M(dot)Boekhold(at)et(dot)tudelft(dot)nl |
-----------------------------------------------------------------------------

Browse pgsql-general by date

  From Date Subject
Next Message Jose' Soares Da Silva 1998-06-17 12:03:43 Re: [GENERAL] COALESCE() or NVL()
Previous Message GABRIEL MORALES CRIBILLERO 1998-06-17 03:27:00 psql