From: | Oskar Stenberg <oskar_stenberg(at)outlook(dot)com> |
---|---|
To: | "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | RE: Working with fixed-point calculations in C |
Date: | 2021-12-08 14:18:36 |
Message-ID: | HE1PR03MB29713B33B0C6FE6ECCB80D82F96F9@HE1PR03MB2971.eurprd03.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi, thanks for your answer!
Yeah, that's correct, I meant NUMERIC and not NUMBER. It was late and I must have accidentally mixed up the names... But thanks for pointing that out! :) But just to clarify, the data type NUMERIC is a fixed point number and not a floating point number?
Alright, so the documentation is just out of date, that's actually what I was hoping for! And while it would be great if it could be updated! Do you in the meantime happen to know where the datatype NUMERIC is defined in the code? And is it the same name in C as in postgres? Or is it something else?
Best Regards
Oskar
-------- Originalmeddelande --------
Från: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Datum: 2021-12-08 04:41 (GMT+01:00)
Till: Oskar Stenberg <oskar_stenberg(at)outlook(dot)com>
Kopia: pgsql-general(at)lists(dot)postgresql(dot)org
Ämne: Re: Working with fixed-point calculations in C
Oskar Stenberg <oskar_stenberg(at)outlook(dot)com> writes:
> I need to make some fixed-point calculations inside the C code that I'm
> developing as an extension to PostgreSQL. I was reading a bit, and if I
> understood the datatype NUMBER correctly, it seems to be just what I'm
> looking for, a fixed-point datatype. (I couldn't actually find any
> thing in the documentation that specifically mentions that it is a
> fixed point datatype. But it seems to work the same. So I might be
> wrong here and if so please tell me)
I think what you are looking for is NUMERIC. (The type name NUMBER
is an Oracle-ism, I believe. I'm not sure how closely that corresponds
to our NUMERIC.)
> Link to the documentation:
> https://www.postgresql.org/docs/current/xfunc-c.html#XFUNC-C-TYPE-TABLE
Hmm, that table seems a bit incomplete/out of date. While it's
not really meant to cover every type, surely it should mention
bigint, numeric, and timestamptz ...
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Shaozhong SHI | 2021-12-08 17:07:27 | Re: How to allow null as an option when using regexp_matches? |
Previous Message | Zwettler Markus (OIZ) | 2021-12-08 13:59:54 | AW: error connecting to pgbouncer admin console |