Hello I try to explicitly detoast a plpgsql var, but I this code breaks a content.
what is wrong?
switch (datum->dtype)
{
case PLPGSQL_DTYPE_VAR:
{
PLpgSQL_var *var = (PLpgSQL_var *) datum;
*typeid = var->datatype->typoid;
*typetypmod = var->datatype->atttypmod;
*isnull = var->isnull;
/*.
* explicitly detoasting a possible
toasted values,
* should to protect us under repeated
detoasting.
* and decomprimiting
*/
if (!*isnull &&
!var->datatype->typbyval && var->datatype->typlen == -1)
{
struct varlena *datum =
PG_DETOAST_DATUM(var->value);
if ((Pointer) datum !=
DatumGetPointer(var->value))
{
free_var(var);
var->value =
PointerGetDatum(datum);
}
*value = var->value;
}
else
*value = var->value;
break;
}
Regards
Pavel Stehule
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
