Re: failed assertion in toasting code

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Sergey E(dot) Koposov" <math(at)sai(dot)msu(dot)ru>
Cc: <pgsql-hackers(at)postgresql(dot)org>, "Oleg Bartunov" <oleg(at)sai(dot)msu(dot)su>
Subject: Re: failed assertion in toasting code
Date: 2008-02-20 12:47:16
Message-ID: 87d4qrx0a3.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


"Sergey E. Koposov" <math(at)sai(dot)msu(dot)ru> writes:

> typedef struct
> {
> int4 length;
> unsigned char data[1];
> } image;
>
> image *im = (image *) palloc(VARHDRSZ + out_len);
> memset(im, 0, VARHDRSZ + out_len);
> im->length = out_len + VARHDRSZ;

Ah, that's not going to work in 8.3 any longer. You have to change this to:

SET_VARSIZE(im, out_len+VARHDRSZ)

And you have to access the length with VARSIZE_ANY_EXHDR() (or a few other
macros but that's the most convenient).

Phew. You had me scared there.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's Slony Replication support!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2008-02-20 12:56:01 Re: More char()/ascii()
Previous Message Alvaro Herrera 2008-02-20 12:36:43 Re: Permanent settings