Re: What happen to the VARATT_SIZEP macro in version 8.3? - Mailing list pgsql-general

From Tom Lane
Subject Re: What happen to the VARATT_SIZEP macro in version 8.3?
Date
Msg-id 20542.1217978312@sss.pgh.pa.us
Whole thread Raw
In response to Re: What happen to the VARATT_SIZEP macro in version 8.3?  (Glyn Astill <glynastill@yahoo.co.uk>)
List pgsql-general
Glyn Astill <glynastill@yahoo.co.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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: bytea encode performance issues
Next
From: "Vyacheslav Kalinin"
Date:
Subject: Re: FTS on patterns