Re: [HACKERS] Numeric with '-'

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: bhirt(at)mobygames(dot)com, Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Numeric with '-'
Date: 2000-02-21 23:57:34
Message-ID: Pine.LNX.4.21.0002220031170.349-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 using an 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(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 2000-02-21 23:57:56 Re: [HACKERS] Beta for 4:30AST ... ?
Previous Message Peter Eisentraut 2000-02-21 23:57:23 Re: [HACKERS] Re: [PATCHES] Patch for more readable parse error messages