Re: trailing junk in numeric literals

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: trailing junk in numeric literals
Date: 2020-12-29 10:24:13
Message-ID: alpine.DEB.2.22.394.2012290614480.3485095@pseudo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Peter,

My 0.02€:

>> So strictly speaking this SQL code is nonstandard anyway. But our
>> lexer has always been forgiving about not requiring space if it's
>> not logically necessary to separate tokens. I doubt trying to
>> change that would improve matters.
>
> Well, the idea is to diagnose potential typos better. But if there is no
> interest, then that's fine.

ISTM that silently accepting bogus syntax hides bugs rather than helps
users. I'm personaly all for fixing these, especially when I'm said user.

My latest catch was:

SELECT TIMESTAMP '2020-12-29Z06:16:18'; # 2020-12-29 00:00:00

But:

SELECT TIMESTAMPTZ '2020-12-29Z06:16:18'; # 2020-12-29 07:16:18+01
SELECT TIMESTAMP '2020-12-29T06:16:18'; # 2020-12-29 06:16:18

I happen to type a O which is close to 0 for which the shift key is also
needed on the French keyboard. This makes the unhelpful:

SELECT 12O; # 12 as O

I think that the policy should be to help user by detecting mistyped
entries, not trying to interpret them out of the norm and expectations.

--
Fabien.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2020-12-29 10:37:24 Re: doc review for v14
Previous Message Ajin Cherian 2020-12-29 09:45:40 Re: [HACKERS] logical decoding of two-phase transactions