PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID16268
PG Version12.2
OSDocker alpine edge
Opened2020-02-20 05:06:24+00
Reported byRekGRpth
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      16268
Logged by:          RekGRpth
Email address:      (redacted)
PostgreSQL version: 12.2
Operating system:   Docker alpine edge
Description:        

const char *data = SPI_getvalue(SPI_tuptable->vals[row],
SPI_tuptable->tupdesc, SPI_fnumber(SPI_tuptable->tupdesc, "data"));

raise TRAP: FailedAssertion("!(IsTransactionState())", File: "catcache.c",
Line: 1213)

but

const char *data = SPI_getvalue_my(SPI_tuptable->vals[row],
SPI_tuptable->tupdesc, SPI_fnumber(SPI_tuptable->tupdesc, "data"));

where

char *SPI_getvalue_my(HeapTuple tuple, TupleDesc tupdesc, int fnumber) {
    bool isnull;
    Datum datum = SPI_getbinval(tuple, tupdesc, fnumber, &isnull);
    if (isnull) return NULL;
    return TextDatumGetCString(datum);
}

works ok

Messages

DateAuthorSubject
2020-02-20 05:06:24+00PG Bug reporting formBUG #16268: SPI_getvalue requires IsTransactionState but TextDatumGetCString of SPI_getbinval - not!
2020-02-20 05:31:31+00Michael PaquierRe: BUG #16268: SPI_getvalue requires IsTransactionState but TextDatumGetCString of SPI_getbinval - not!