Re: WIP Patch: Add a function that returns binary JSONB as a bytea
| От | Andres Freund |
|---|---|
| Тема | Re: WIP Patch: Add a function that returns binary JSONB as a bytea |
| Дата | |
| Msg-id | 20181102211816.eznnyvenxweqbzza@alap3.anarazel.de обсуждение исходный текст |
| Ответ на | Re: WIP Patch: Add a function that returns binary JSONB as a bytea (Tom Lane <tgl@sss.pgh.pa.us>) |
| Список | pgsql-hackers |
Hi,
On 2018-11-02 11:52:59 -0400, Tom Lane wrote:
> Andres' point about alignment is a pretty good one as well, if it applies
> here --- I don't recall just what internal alignment requirements jsonb
> has. We have not historically expected clients to have to deal with that.
Certainly looks like it takes it into account:
static void
fillJsonbValue(JsonbContainer *container, int index,
char *base_addr, uint32 offset,
JsonbValue *result)
...
else if (JBE_ISNUMERIC(entry))
{
result->type = jbvNumeric;
result->val.numeric = (Numeric) (base_addr + INTALIGN(offset));
}
...
else
{
Assert(JBE_ISCONTAINER(entry));
result->type = jbvBinary;
/* Remove alignment padding from data pointer and length */
result->val.binary.data = (JsonbContainer *) (base_addr + INTALIGN(offset));
result->val.binary.len = getJsonbLength(container, index) -
(INTALIGN(offset) - offset);
}
...
Greetings,
Andres Freund
В списке pgsql-hackers по дате отправления: