Re: Is float8 a reference type?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is float8 a reference type?
Date: 2017-09-23 03:28:11
Message-ID: CAFj8pRAMHbEBp0nJQy9B=_5Tr5QOisDNOEEZ=8KSVAE6kDFcXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2017-09-23 5:10 GMT+02:00 Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>:

> On Fri, Sep 22, 2017 at 8:05 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)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
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-09-23 03:38:06 Re: Is float8 a reference type?
Previous Message Paul A Jungwirth 2017-09-23 03:10:31 Re: Is float8 a reference type?