How to detoast a column of type BYTEAOID

From: <david(at)andl(dot)org>
To: <pgsql-general(at)postgresql(dot)org>
Subject: How to detoast a column of type BYTEAOID
Date: 2016-04-18 04:38:11
Message-ID: 003101d1992c$1f7e59c0$5e7b0d40$@andl.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am attempting to create a new language implementation. The language is
Andl (andl.org) so the handler is plandl.
I am having a bit of trouble executing SPI queries from inside plandl.

The particular problem arises after calling SPI_cursor_fetch() and then
SPI_getbinval() on a column of type BYTEA (BYTEAOID 17). I was expecting to
get back a Datum of type bytea, but the length is crazy. From the look of
the data, I suspect that what I have is a compressed TOAST, and I don't know
how to handle those.

1. Does SPI_getbinval() indeed return compressed TOAST values?
2. If so, what should I do (in general) to ensure the values I retrieve are
de-toasted?

Regards
David M Bennett FACS

Andl - A New Database Language - andl.org

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Rowley 2016-04-18 04:47:42 Re: Enhancement request for pg_dump
Previous Message Gavin Flower 2016-04-18 01:34:39 Re: $foo $bar is BAD