aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pl/plpython/plpy_cursorobject.c4
-rw-r--r--src/pl/plpython/plpy_spi.c8
2 files changed, 3 insertions, 9 deletions
diff --git a/src/pl/plpython/plpy_cursorobject.c b/src/pl/plpython/plpy_cursorobject.c
index a527585b818..e32bc568bc2 100644
--- a/src/pl/plpython/plpy_cursorobject.c
+++ b/src/pl/plpython/plpy_cursorobject.c
@@ -444,9 +444,7 @@ PLy_cursor_fetch(PyObject *self, PyObject *args)
ret->status = PyInt_FromLong(SPI_OK_FETCH);
Py_DECREF(ret->nrows);
- ret->nrows = (SPI_processed > (uint64) LONG_MAX) ?
- PyFloat_FromDouble((double) SPI_processed) :
- PyInt_FromLong((long) SPI_processed);
+ ret->nrows = PyLong_FromUnsignedLongLong(SPI_processed);
if (SPI_processed != 0)
{
diff --git a/src/pl/plpython/plpy_spi.c b/src/pl/plpython/plpy_spi.c
index 0c623a94581..41155fc81ec 100644
--- a/src/pl/plpython/plpy_spi.c
+++ b/src/pl/plpython/plpy_spi.c
@@ -371,9 +371,7 @@ PLy_spi_execute_fetch_result(SPITupleTable *tuptable, uint64 rows, int status)
if (status > 0 && tuptable == NULL)
{
Py_DECREF(result->nrows);
- result->nrows = (rows > (uint64) LONG_MAX) ?
- PyFloat_FromDouble((double) rows) :
- PyInt_FromLong((long) rows);
+ result->nrows = PyLong_FromUnsignedLongLong(rows);
}
else if (status > 0 && tuptable != NULL)
{
@@ -381,9 +379,7 @@ PLy_spi_execute_fetch_result(SPITupleTable *tuptable, uint64 rows, int status)
MemoryContext cxt;
Py_DECREF(result->nrows);
- result->nrows = (rows > (uint64) LONG_MAX) ?
- PyFloat_FromDouble((double) rows) :
- PyInt_FromLong((long) rows);
+ result->nrows = PyLong_FromUnsignedLongLong(rows);
cxt = AllocSetContextCreate(CurrentMemoryContext,
"PL/Python temp context",