pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: tim.needham2@gmail.com
Subject: Example numeric constants aren't valid?
Date: Fri, 06 Oct 2023 19:49:47 +0000
Message-ID: <169662178727.656.13352118577309407578@wrigleys.postgresql.org> (raw)

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


view thread (3+ messages)  latest in thread

Message-ID: <169662178727.656.13352118577309407578@wrigleys.postgresql.org>
Permalink:  ../169662178727.656.13352118577309407578@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/169662178727.656.13352118577309407578@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-docs@lists.postgresql.org, tim.needham2@gmail.com
  Subject: Re: Example numeric constants aren't valid?
  In-Reply-To: <169662178727.656.13352118577309407578@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox