thinko in convertToJsonb() - Mailing list pgsql-hackers

From Mark Dilger
Subject thinko in convertToJsonb()
Date
Msg-id 2FA1D6D6-78DC-4754-8E7D-360AE07DFE8A@port25.com
Whole thread Raw
Responses Re: thinko in convertToJsonb()  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
The call:
reserveFromBuffer(&buffer, sizeof(VARHDRSZ))

is assuming that the size of varlena header is the same
size as the type used to return that size, which happens
to be so, but someone could easily change that macro
to:
#define VARHDRSZ ((int64) sizeof(int32))

And you'd want to reserve sizeof(int32), not sizeof(int64)
in convertToJsonb.

Perhaps the code really meant to say:
reserveFromBuffer(&buffer, VARHDRSZ)


mark



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: logical column ordering
Next
From: Alvaro Herrera
Date:
Subject: Re: logical column ordering