Re: What happen to the VARATT_SIZEP macro in version 8.3?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: glynastill(at)yahoo(dot)co(dot)uk
Cc: pgsql-general(at)postgresql(dot)org, Don Pannese <don(dot)pannese(at)hds(dot)com>
Subject: Re: What happen to the VARATT_SIZEP macro in version 8.3?
Date: 2008-08-05 23:18:32
Message-ID: 20542.1217978312@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Glyn Astill <glynastill(at)yahoo(dot)co(dot)uk> writes:
>> What replaces the VARATT_SIZEP macro in version 8.3? I have spent a
>> long time checking the documentation and have not found the answer.

> SET_VARSIZE

Yes; you should always use VARSIZE() to fetch the length and
SET_VARSIZE() to set it. If you need your code to still work
with pre-8.3 releases, you can make yourself a compatibility
macro like this:

#ifndef SET_VARSIZE
#define SET_VARSIZE(v,l) (VARATT_SIZEP(v) = (l))
#endif

Also note that detoasting might be needed in more places than
it was in 7.4; if you were cutting corners on a toastable type,
you'll have to check your code carefully.

See more advice here:
http://archives.postgresql.org/pgsql-general/2007-10/msg00604.php

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vyacheslav Kalinin 2008-08-06 00:25:59 Re: FTS on patterns
Previous Message Tom Lane 2008-08-05 22:57:10 Re: bytea encode performance issues