Re: [HACKERS] How to extract bytes from a bit/bit(n) Datum pointer?

Поиск
Список
Период
Сортировка
От Ashutosh Bapat
Тема Re: [HACKERS] How to extract bytes from a bit/bit(n) Datum pointer?
Дата
Msg-id CAFjFpRcfmhjsGSkJPW5EVinrzypmemgUkQQ1VyQ7UEMHvH9Ccw@mail.gmail.com
обсуждение исходный текст
Ответ на [HACKERS] How to extract bytes from a bit/bit(n) Datum pointer?  (valeriof <valerio_farruggio@hotmail.com>)
Ответы Re: [HACKERS] How to extract bytes from a bit/bit(n) Datum pointer?  (valeriof <valerio_farruggio@hotmail.com>)
Список pgsql-hackers
On Thu, Jan 19, 2017 at 5:53 PM, valeriof <valerio_farruggio@hotmail.com> wrote:
> Hi,
>
> This may come from my lack of experience with Postgres, but I'm trying to
> extract the byte portion of a Datum that is of type VarBit - bit/bit(n). I
> see that the Datum pointer contains the value content of the bytes (after a
> few bytes for the header) but I would need to point to the actual value
> (plus also the number of bytes to be picked up).


>
> I currently have a similar issue with BYTEAOID columns. I have a Datum
> pointer but can't get the actual content.

If you have not looked at DatumGetVarBitP() and DatumGetByteaP(), that
will get you corresponding structure pointers from a Datum. Then check
src/backend/utils/adt/varbit.c and bytea_* functions from
src/backend/utils/adt/varlena.c to understand how those structures are
used.

-- 
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: [HACKERS] patch: function xmltable
Следующее
От: Andrew Borodin
Дата:
Сообщение: Re: [HACKERS] Review: GIN non-intrusive vacuum of posting tree