From: Vadim B. Mikheev Date: Mon, 29 Sep 1997 06:28:45 +0000 (+0000) Subject: Fix error indicator for SPI_getvalue() and SPI_getbinval() X-Git-Tag: REL6_2~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f6381d7e739603b6b242bd9f6d8fbaa7e8f4ce6;p=postgresql Fix error indicator for SPI_getvalue() and SPI_getbinval() --- diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index 646cfca401..16a8ee3212 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -414,7 +414,10 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber) SPI_result = 0; if (tuple->t_natts < fnumber || fnumber <= 0) + { + SPI_result = SPI_ERROR_NOATTRIBUTE; return (NULL); + } val = heap_getattr(tuple, InvalidBuffer, fnumber, tupdesc, &isnull); if (isnull) @@ -437,7 +440,10 @@ SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull) *isnull = true; SPI_result = 0; if (tuple->t_natts < fnumber || fnumber <= 0) + { + SPI_result = SPI_ERROR_NOATTRIBUTE; return ((Datum) NULL); + } val = heap_getattr(tuple, InvalidBuffer, fnumber, tupdesc, isnull);