8000 This patch fixes the well-known but unfixed bug that fetchone() always · jaylevitt/postgres@8b97a09 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8b97a09

Browse files
committed
This patch fixes the well-known but unfixed bug that fetchone() always
returns the first result in the DB-API compliant wrapper. It turned out that the bug was way down in the C code. Gerhard Häring
1 parent c43d241 commit 8b97a09

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/interfaces/python/pgmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,13 +554,13 @@ pgsource_fetch(pgsourceobject * self, PyObject * args)
554554

555555
for (j = 0; j < self->num_fields; j++)
556556
{
557-
if (PQgetisnull(self->last_result, i, j))
557+
if (PQgetisnull(self->last_result, self->current_row, j))
558558
{
559559
Py_INCREF(Py_None);
560560
str = Py_None;
561561
}
562562
else
563-
str = PyString_FromString(PQgetvalue(self->last_result, i, j));
563+
str = PyString_FromString(PQgetvalue(self->last_result, self->current_row, j));
564564

565565
PyTuple_SET_ITEM(rowtuple, j, str);
566566
}

0 commit comments

Comments
 (0)
0