pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: rekgrpth@gmail.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16268: SPI_getvalue requires IsTransactionState but TextDatumGetCString of SPI_getbinval - not!
Date: Thu, 20 Feb 2020 14:31:31 +0900
Message-ID: <20200220053131.GJ2288@paquier.xyz> (raw)
In-Reply-To: <16268-3d91474b3e57a5bf@postgresql.org>
References: <16268-3d91474b3e57a5bf@postgresql.org>

On Thu, Feb 20, 2020 at 05:06:24AM +0000, PG Bug reporting form wrote:
> 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)

Catalog cache lookups have to happen in the context of a transaction,
this is what this assertion failure means, so your code is doing
something incorrect.  We have such examples of short-term transactions
opened in the PostgreSQL code for some cache lookups.
IdentifySystem() in walsender.c looking for the database name is one
such example (see StartTransactionCommand and CommitTransactionCommand).
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (2+ messages)

Message-ID: <20200220053131.GJ2288@paquier.xyz>
Permalink:  ../20200220053131.GJ2288@paquier.xyz/
Also on:    postgresql.org/message-id/20200220053131.GJ2288@paquier.xyz

 · 

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: michael@paquier.xyz, rekgrpth@gmail.com
  Subject: Re: BUG #16268: SPI_getvalue requires IsTransactionState but TextDatumGetCString of SPI_getbinval - not!
  In-Reply-To: <20200220053131.GJ2288@paquier.xyz>
  References: <16268-3d91474b3e57a5bf@postgresql.org> <20200220053131.GJ2288@paquier.xyz>

* 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