pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: gmail Vladimir Koković <vladimir.kokovic@gmail.com>
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15653: pg_detoast_datum_packed problem
Date: Fri, 8 Mar 2019 19:47:41 +0100
Message-ID: <13b4fc8a-b790-ddec-bf02-fe99ed793a5b@gmail.com> (raw)
In-Reply-To: <8a0d54a5-1c94-aa00-7e22-7d16566839b4@gmail.com>
References: <15653-a9979a97bd11577d@postgresql.org>
	<f06d47f0-3e93-fed4-d538-9e012deec2c4@gmail.com>
	<8a0d54a5-1c94-aa00-7e22-7d16566839b4@gmail.com>

Hi,

/* SQL function: bvarchar(varchar) returns bytea */

PG_FUNCTION_INFO_V1(pg_bvarchar);
Datum pg_bvarchar(PG_FUNCTION_ARGS) {
   VarChar *arg = PG_GETARG_VARCHAR_PP(0);
     unsigned    len;
     bytea       *res;
     len = VARSIZE( arg ) - VARHDRSZ;
     res = (text *)palloc( len + VARHDRSZ );
     SET_VARSIZE( res, len + VARHDRSZ );
     memcpy( VARDATA( res ), VARDATA( arg ), len);
     PG_RETURN_BYTEA_P(res);
}

Vladimir Koković, DP senior(69)
Belgrade, Mar. 1 2019





view thread (9+ messages)  latest in thread

Message-ID: <13b4fc8a-b790-ddec-bf02-fe99ed793a5b@gmail.com>
Permalink:  ../13b4fc8a-b790-ddec-bf02-fe99ed793a5b@gmail.com/
Also on:    postgresql.org/message-id/13b4fc8a-b790-ddec-bf02-fe99ed793a5b@gmail.com

 · 

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: vladimir.kokovic@gmail.com
  Subject: Re: BUG #15653: pg_detoast_datum_packed problem
  In-Reply-To: <13b4fc8a-b790-ddec-bf02-fe99ed793a5b@gmail.com>
  References: <15653-a9979a97bd11577d@postgresql.org> <f06d47f0-3e93-fed4-d538-9e012deec2c4@gmail.com> <8a0d54a5-1c94-aa00-7e22-7d16566839b4@gmail.com> <13b4fc8a-b790-ddec-bf02-fe99ed793a5b@gmail.com>

* 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