Re: trailing junk in numeric literals

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: trailing junk in numeric literals
Date: 2020-12-28 20:54:59
Message-ID: 1850223.1609188899@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> writes:
> I was surprised to find that this doesn't error:
> => select 100a;
> a
> -----
> 100

> I suspect this and similar cases used to error before aliases without AS
> were introduced. But now this seems possibly problematic. Should we
> try to handle this better?

Meh. I think you'd get more brickbats than kudos if you start insisting
on a space there.

I'm too lazy to try to decipher the SQL spec right now, but ISTR that
it insists on whitespace between a numeric literal and an identifier.
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.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2020-12-28 22:06:40 Re: New IndexAM API controlling index vacuum strategies
Previous Message Peter Eisentraut 2020-12-28 20:22:58 trailing junk in numeric literals