From: | gmail Vladimir Koković <vladimir(dot)kokovic(at)gmail(dot)com> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #15653: pg_detoast_datum_packed problem |
Date: | 2019-03-08 18:47:41 |
Message-ID: | 13b4fc8a-b790-ddec-bf02-fe99ed793a5b@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gierth | 2019-03-08 19:15:43 | Re: BUG #15653: pg_detoast_datum_packed problem |
Previous Message | gmail Vladimir Koković | 2019-03-08 18:46:45 | Re: BUG #15653: pg_detoast_datum_packed problem |