Re: [GENERAL] Is float8 a reference type?

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: [GENERAL] Is float8 a reference type?
Дата
Msg-id CAFj8pRAMHbEBp0nJQy9B=_5Tr5QOisDNOEEZ=8KSVAE6kDFcXQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Is float8 a reference type?  (Paul A Jungwirth <pj@illuminatedcomputing.com>)
Список pgsql-general


2017-09-23 5:10 GMT+02:00 Paul A Jungwirth <pj@illuminatedcomputing.com>:
On Fri, Sep 22, 2017 at 8:05 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> yes, it is 8 bytes on 64-bit.

Thanks!

> I don't think so it is good idea to write 64bit only extensions.

I agree, but how about this?:

    if (FLOAT8PASSBYVAL) {
      datums = (Datum *)floats;
    } else {
      datums = palloc0(arrlen * sizeof(Datum));
      for (i = 0; i < arrlen; i++) {
        datums[i] = Float8GetDatum(floats[i]);
      }
    }

it can work.

You have to solve deallocation in only one path. palloc0 is not necessary in this case.
 

Thanks,
Paul

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

Предыдущее
От: Paul A Jungwirth
Дата:
Сообщение: Re: [GENERAL] Is float8 a reference type?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Is float8 a reference type?