Commit 3f6381d7 authored by Vadim B. Mikheev's avatar Vadim B. Mikheev

Fix error indicator for SPI_getvalue() and SPI_getbinval()

parent 51689ece
...@@ -414,7 +414,10 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber) ...@@ -414,7 +414,10 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
SPI_result = 0; SPI_result = 0;
if (tuple->t_natts < fnumber || fnumber <= 0) if (tuple->t_natts < fnumber || fnumber <= 0)
{
SPI_result = SPI_ERROR_NOATTRIBUTE;
return (NULL); return (NULL);
}
val = heap_getattr(tuple, InvalidBuffer, fnumber, tupdesc, &isnull); val = heap_getattr(tuple, InvalidBuffer, fnumber, tupdesc, &isnull);
if (isnull) if (isnull)
...@@ -437,7 +440,10 @@ SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull) ...@@ -437,7 +440,10 @@ SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull)
*isnull = true; *isnull = true;
SPI_result = 0; SPI_result = 0;
if (tuple->t_natts < fnumber || fnumber <= 0) if (tuple->t_natts < fnumber || fnumber <= 0)
{
SPI_result = SPI_ERROR_NOATTRIBUTE;
return ((Datum) NULL); return ((Datum) NULL);
}
val = heap_getattr(tuple, InvalidBuffer, fnumber, tupdesc, isnull); val = heap_getattr(tuple, InvalidBuffer, fnumber, tupdesc, isnull);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment