Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3f6381d

Browse files
committed
Fix error indicator for SPI_getvalue() and SPI_getbinval()
1 parent 51689ec commit 3f6381d

File tree

1 file changed

+6
-0
lines changed
  • src/backend/executor

1 file changed

+6
-0
lines changed

src/backend/executor/spi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,10 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
414414

415415
SPI_result = 0;
416416
if (tuple->t_natts < fnumber || fnumber <= 0)
417+
{
418+
SPI_result = SPI_ERROR_NOATTRIBUTE;
417419
return (NULL);
420+
}
418421

419422
val = heap_getattr(tuple, InvalidBuffer, fnumber, tupdesc, &isnull);
420423
if (isnull)
@@ -437,7 +440,10 @@ SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull)
437440
*isnull = true;
438441
SPI_result = 0;
439442
if (tuple->t_natts < fnumber || fnumber <= 0)
443+
{
444+
SPI_result = SPI_ERROR_NOATTRIBUTE;
440445
return ((Datum) NULL);
446+
}
441447

442448
val = heap_getattr(tuple, InvalidBuffer, fnumber, tupdesc, isnull);
443449

0 commit comments

Comments
 (0)