going through DatumGetPointer or some other "official" conversion macro.
Not actually a bug, since Datum the same size as pointer is the only
supported case at the moment, but good cleanup for the future.
Gavin Sherry
* If we're working with an untoasted source, no need to do an extra
* copying step.
*/
- if (VARATT_IS_COMPRESSED(str) || VARATT_IS_EXTERNAL(str))
+ if (VARATT_IS_COMPRESSED(DatumGetPointer(str)) ||
+ VARATT_IS_EXTERNAL(DatumGetPointer(str)))
slice = DatumGetTextPSlice(str, slice_start, slice_size);
else
slice = (text *) DatumGetPointer(str);
result = DirectFunctionCall3(pg_convert, string,
src_encoding_name, dest_encoding_name);
- PG_RETURN_BYTEA_P(result);
+ PG_RETURN_DATUM(result);
}
/*
* in this case it will be because we've told pg_convert to return one
* that is valid as text in the current database encoding.
*/
- PG_RETURN_TEXT_P(result);
+ PG_RETURN_DATUM(result);
}
/*