Example numeric constants aren't valid?

Started by PG Bug reporting formover 2 years ago3 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/16/sql-syntax-lexical.html
Description:

Hi,

Re. Docs page:
https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS-NUMERIC

I noticed that the following are specified as valid numeric constants:

1_500_000_000
0b10001000_00000000
0o_1_755
0xFFFF_FFFF
1.618_034

So I'd expect something like:

SELECT 1.618_034;

...to return 1.618034? But instead I get 1.618.

And:

SELECT 1_500_000_000::text;

...results in a: ERROR: syntax error at or near "::"

Which seems at odds to what the docs say:
"For visual grouping, underscores can be inserted between digits. These have
no further effect on the value of the constant."

I'm left not really understanding how to use _ in numerical constants?

Tim

#2Vik Fearing
vik@postgresfriends.org
In reply to: PG Bug reporting form (#1)
Re: Example numeric constants aren't valid?

On 10/6/23 20:49, PG Doc comments form wrote:

I'm left not really understanding how to use _ in numerical constants?

You are reading the documentation for 16, but you are using 14 or lower.
If you want this functionality, you need to upgrade your server.
--
Vik Fearing

#3Tim Needham
tim.needham2@gmail.com
In reply to: Vik Fearing (#2)
Re: Example numeric constants aren't valid?

Oh goodness, sorry Vik.

On Mon, Oct 9, 2023 at 11:37 AM Vik Fearing <vik@postgresfriends.org> wrote:

Show quoted text

On 10/6/23 20:49, PG Doc comments form wrote:

I'm left not really understanding how to use _ in numerical constants?

You are reading the documentation for 16, but you are using 14 or lower.
If you want this functionality, you need to upgrade your server.
--
Vik Fearing