]> granicus.if.org Git - postgresql/commitdiff
Fix error indicator for SPI_getvalue() and SPI_getbinval()
authorVadim B. Mikheev <vadim4o@yahoo.com>
Mon, 29 Sep 1997 06:28:45 +0000 (06:28 +0000)
committerVadim B. Mikheev <vadim4o@yahoo.com>
Mon, 29 Sep 1997 06:28:45 +0000 (06:28 +0000)
src/backend/executor/spi.c

index 646cfca401aa77730d749503830fd42d054c9b00..16a8ee3212834d9eaf1d76259af1833e798d2151 100644 (file)
@@ -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);