Example numeric constants aren't valid?

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: tim(dot)needham2(at)gmail(dot)com
Subject: Example numeric constants aren't valid?
Date: 2023-10-06 19:49:47
Message-ID: 169662178727.656.13352118577309407578@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

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

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Kirk Parker 2023-10-07 18:10:28 Typo in PL/pgSQL trigger Example 43.4?
Previous Message Bruce Momjian 2023-10-06 19:30:43 Re: ODBC options