Is float8 a reference type?

From: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Is float8 a reference type?
Date: 2017-09-23 02:52:33
Message-ID: CA+renyXDNtPyB+fhcDQXYh2+FhnYArEPVpcph+k3Pi65MKUf1A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The docs say that a Datum can be 4 bytes or 8 depending on the machine:

https://www.postgresql.org/docs/9.5/static/sql-createtype.html

Is a Datum always 8 bytes for 64-bit architectures?

And if so, can my C extension skip a loop like this when compiling
there, and just do a memcpy (or even a cast)?:

float8 *floats;
Datum *datums;

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

Thanks!
Paul

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2017-09-23 03:05:05 Re: Is float8 a reference type?
Previous Message legrand legrand 2017-09-22 21:51:24 Re: Multicolumn Index on OR conditions