Re: [HACKERS] Numeric with '-' - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] Numeric with '-'
Date
Msg-id Pine.LNX.4.21.0002220031170.349-100000@localhost.localdomain
Whole thread Raw
In response to Re: [HACKERS] Numeric with '-'  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Numeric with '-'
List pgsql-hackers
On 2000-02-21, Tom Lane mentioned:

> I've been ranting about this in a recent pghackers thread ;-).
> The lexer shouldn't have to commit to a conversion to float8
> in order to report that a token looks like a numeric literal.

Has the ranting resulted in any idea yet? ISTM that keeping a non-integer
number as a string all the way to the executor shouldn't hurt too much.
After all, according to SQL 123.45 *is* a NUMERIC literal! By making it a
float we're making our users liable to breaking all kinds of fiscal
regulations in some places. (Ask Jan.)

> The resulting error message
> ERROR:  Unable to convert left operator '-' from type 'unknown'
> isn't exactly up to a high standard of clarity either;

Speaking of 'unknown', this is my favourite brain-damaged query of all
times:

peter=> select 'a' like 'a';
ERROR:  Unable to identify an operator '~~' for types 'unknown' and 'unknown'       You will have to retype this query
usingan explicit cast
 

Is there a good reason that a character literal is unknown? I'm sure the
reasons lie somewhere in the extensible type system, but if I wanted it to
be something else explicitly then I would have written DATE 'yesterday'.


-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] Re: [PATCHES] Patch for more readable parse error messages
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] Re: SQL compliance - why -- comments only at psql level?