Prevent numeric literals from having non-numeric trailing characters (Peter Eisentraut)

Started by Fabrice Chapuis7 months ago3 messages
#1Fabrice Chapuis
fabrice636861@gmail.com

Regarding the changes made in version 15 for the traitment of the non-numeric
trailing characters, why does parsing continue to be permissive with
parentheses (no need to add a space)? Are we still in standard SQL?

Regards

Fabrice

SELECT (123)order by 1;
+----------+
| ?column? |
+----------+
| 123 |
+----------+
(1 row)

postgres [2043238]=# SELECT (123)abc;
+-----+
| abc |
+-----+
| 123 |
+-----+
(1 row)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Fabrice Chapuis (#1)
Re: Prevent numeric literals from having non-numeric trailing characters (Peter Eisentraut)

Fabrice Chapuis <fabrice636861@gmail.com> writes:

Regarding the changes made in version 15 for the traitment of the non-numeric
trailing characters, why does parsing continue to be permissive with
parentheses (no need to add a space)?

A parenthesis cannot be part of a larger token, so I don't see
any ambiguity that we'd need to resolve by requiring spaces.

regards, tom lane

#3Peter Eisentraut
peter@eisentraut.org
In reply to: Fabrice Chapuis (#1)
Re: Prevent numeric literals from having non-numeric trailing characters (Peter Eisentraut)

On 20.06.25 15:29, Fabrice Chapuis wrote:

Regarding the changes made in version 15 for the traitment of the non-
numeric trailing characters, why does parsing continue to be permissive
with parentheses (no need to add a space)? Are we still in standard SQL?

Yes, a parenthesis is a "delimiter token", so there does not need to be
a separator between it and an adjacent token.