pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: rekgrpth@gmail.com
Subject: BUG #16268: SPI_getvalue requires IsTransactionState but TextDatumGetCString of SPI_getbinval - not!
Date: Thu, 20 Feb 2020 05:06:24 +0000
Message-ID: <16268-3d91474b3e57a5bf@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      16268
Logged by:          RekGRpth
Email address:      rekgrpth@gmail.com
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



view thread (2+ messages)  latest in thread

Message-ID: <16268-3d91474b3e57a5bf@postgresql.org>
Permalink:  ../16268-3d91474b3e57a5bf@postgresql.org/
Also on:    postgresql.org/message-id/16268-3d91474b3e57a5bf@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, rekgrpth@gmail.com
  Subject: Re: BUG #16268: SPI_getvalue requires IsTransactionState but TextDatumGetCString of SPI_getbinval - not!
  In-Reply-To: <16268-3d91474b3e57a5bf@postgresql.org>
  References: <16268-3d91474b3e57a5bf@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox