public inbox for [email protected]
help / color / mirror / Atom feedfloat and float(p) missing from table 8.1
2+ messages / 2 participants
[nested] [flat]
* float and float(p) missing from table 8.1
@ 2018-03-18 17:11 PG Doc comments form <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: PG Doc comments form @ 2018-03-18 17:11 UTC (permalink / raw)
To: [email protected]; +Cc: [email protected]
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/10/static/datatype.html
Description:
Maybe it is intentional, but the float and float(p) data types are missing
from table 8.1
(https://www.postgresql.org/docs/10/static/datatype.html#DATATYPE-TABLE).
float4 and float8 are listed.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: float and float(p) missing from table 8.1
@ 2018-04-03 14:26 Bruce Momjian <[email protected]>
parent: PG Doc comments form <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Bruce Momjian @ 2018-04-03 14:26 UTC (permalink / raw)
To: [email protected]; [email protected]
On Sun, Mar 18, 2018 at 05:11:40PM +0000, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/10/static/datatype.html
> Description:
>
> Maybe it is intentional, but the float and float(p) data types are missing
> from table 8.1
> (https://www.postgresql.org/docs/10/static/datatype.html#DATATYPE-TABLE).
> float4 and float8 are listed.
Yes, I think it is intentional and is caused by the multiple aliases we
have for numeric values. As you probably noted from the chart, the
primary type name is 'real', which is ANSI specified, with an alias
listed as float4. There is also double precision, with an alias of
float8.
float() is more complicated since it can be either real/float4 or double
precision/float8 depending on the length, e.g.:
CREATE TABLE test(x FLOAT(1), x2 FLOAT(25));
\d test
Table "public.test"
Column | Type | Collation | Nullable | Default
--------+------------------+-----------+----------+---------
x | real | | |
x2 | double precision | | |
The switch from float4/float8 happens at binary digit length 25, and
this is documented:
https://www.postgresql.org/docs/10/static/datatype-numeric.html#DATATYPE-FLOAT
PostgreSQL also supports the SQL-standard notations float and float(p)
for specifying inexact numeric types. Here, p specifies the minimum
acceptable precision in binary digits. PostgreSQL accepts float(1) to
float(24) as selecting the real type, while float(25) to float(53)
select double precision. Values of p outside the allowed range draw an
error. float with no precision specified is taken to mean double
precision.
Adding float() to that chart seems like it would add too much complexity.
--
Bruce Momjian <[email protected]> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-04-03 14:26 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-18 17:11 float and float(p) missing from table 8.1 PG Doc comments form <[email protected]>
2018-04-03 14:26 ` Bruce Momjian <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox