Re: Where are the detoast function called in select * from table_name case?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Rui Hai Jiang <ruihaijiang(at)msn(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Where are the detoast function called in select * from table_name case?
Date: 2015-05-06 13:14:24
Message-ID: CAFj8pRCONBsoZMv4sT=9cSq9=Vc0AQsMvLw6JuENhSsE7CboHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

Depends on usage, but often times the detoasting is called from
DatumGet***** macros

The values are detoasted only when it is required

#define PG_GETARG_TEXT_PP(n) DatumGetTextPP(PG_GETARG_DATUM(n))
#define DatumGetTextPP(X) ((text *) PG_DETOAST_DATUM_PACKED(X))
#define PG_DETOAST_DATUM(datum) >pg_detoast_datum((struct varlena *)
DatumGetPointer(datum))

Regards

Pavel Stehule

2015-05-06 15:00 GMT+02:00 Rui Hai Jiang <ruihaijiang(at)msn(dot)com>:

> Hello,
>
> I've been reading the PostgreSQL code for weeks to figure out how TOAST
> works.
> I couldn't find where are the TOAST function called to detoast a tuple
> comes from a select query, for example, select * from table_name.
> Does anyone know this? Can you give me some help? And any help would save
> me a lot of time.
>
> Thanks,
> Rui Hai
>
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2015-05-06 13:15:13 Re: is possible to upgrade from 9.2 to 9.4 with pg_upgrade
Previous Message Heikki Linnakangas 2015-05-06 13:12:44 Re: Where are the detoast function called in select * from table_name case?