Re: [HACKERS] Bug?

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom I Helbekkmo <tih(at)hamartun(dot)priv(dot)no>, "Meskes, Michael" <meskes(at)topsystem(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Bug?
Date: 1998-02-09 05:45:05
Message-ID: 34DE97E1.51C5517D@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > My worry about that is for the (unlikely, but possible) case where a
> > user gives a large number as a constant in a query, believing it to be
> > an integer. If we signal an error, the user will know that the number
> > was out of range. If not, we may end up doing calculations on floats
> > that the user wanted done on integers. This may mean losing accuracy,
> > which is something you don't want to do behind the user's back.
>
> Something just struck me... How's this for a workaround? It lets you
> enter large floats that happen to be integral without any explicit
> indication of the fact that they are floats, which was the original
> intent of this whole thread, while letting the user know that we're
> doing it. In effect, we're saying "sure, you can do this on the fly,
> and we'll do the right thing, but please be explicit in stored code".
> I don't know how the NOTICE is treated in all situations, though. If
> the user doesn't see it, there isn't much point in having it. What
> happens for the various interface methods? Will it be shown to a user
> accessing a database from MS Excel using ODBC, for instance?

Per Tom H's suggestion; what do you think Bruce?

postgres=> select 100000000000;
NOTICE: Integer input '100000000000' is out of range; promoted to float
?column?
------------
100000000000
(1 row)

That would alleviate the "hidden" side effects, but still come closer to
doing something helpful...

- Tom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Billy G. Allie 1998-02-09 06:57:54 The use of macros for heap_getattr.
Previous Message Kapsaris 1998-02-08 21:58:46 subscribe pgsql-hackers kapsaris@aol.com