Re: trailing junk in numeric literals - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: trailing junk in numeric literals
Date
Msg-id alpine.DEB.2.22.394.2012290614480.3485095@pseudo
Whole thread Raw
In response to Re: trailing junk in numeric literals  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
List 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.

pgsql-hackers by date:

Previous
From: Ajin Cherian
Date:
Subject: Re: [HACKERS] logical decoding of two-phase transactions
Next
From: Magnus Hagander
Date:
Subject: Re: doc review for v14