>>>>> "gmail" == gmail Vladimir Koković <vladimir(dot)kokovic(at)gmail(dot)com> writes:
gmail> VarChar *arg = PG_GETARG_VARCHAR_PP(0);
The _PP there means that this is allowed to return either a packed
(short) varlena or a normal one...
gmail> len = VARSIZE( arg ) - VARHDRSZ;
...but VARSIZE is only allowed on unpacked varlenas, you need to use
VARSIZE_ANY_EXHDR instead (and VARDATA_ANY rather than VARDATA).
--
Andrew (irc:RhodiumToad)