Re: Why don't we accept exponential format for integers?

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Josh Berkus <josh(at)agliodbs(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why don't we accept exponential format for integers?
Date: 2010-12-17 20:52:04
Message-ID: 20101217155204.c1a92fe8.wmoran@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In response to Jeff Janes <jeff(dot)janes(at)gmail(dot)com>:

> On Fri, Dec 17, 2010 at 12:16 PM, Bill Moran <wmoran(at)potentialtech(dot)com> wrote:
> > In response to Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> >
> >> Josh Berkus <josh(at)agliodbs(dot)com> writes:
> >> > postgres=# select '1e+01'::Integer
> >> > postgres-# ;
> >> > ERROR:  invalid input syntax for integer: "1e+01"
> >>
> >> I have never heard of any programming system anywhere that accepts such
> >> a syntax for integers (assuming it distinguishes integers from other
> >> numbers at all).  I'm not excited about being the first.  Why does this
> >> error surprise you?  It doesn't seem particularly different from arguing
> >> that 1.000 should be considered an integer, which strikes me as a
> >> seriously bad idea.
> >
> > But
> > SELECT 1.000::Integer;
> > works.  And so does
> > SELECT 1.234::Integer;
>
> And so does:
> SELECT 1.23e+01::Integer
>
>
> > which I find just as dangerous as
> > SELECT '1.234e+01'::Integer;
>
> Add quotes to either of the other two, and then they don't work either.

Ah ... I wasn't looking carefully enough, that changes the landscape
quite a bit ...

--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2010-12-17 21:01:06 typed table casting
Previous Message Robert Haas 2010-12-17 20:50:52 Re: unlogged tables vs. GIST