Thread: RE: [HACKERS] Bug?

RE: [HACKERS] Bug?

From
"Meskes, Michael"
Date:
Is there a way to explicitely tell the parser which kind of variable we
want? That is something like float(1) to get 1.0.

It's obviously easier in Oracle (where my source came from) since they
only have one number type. But expclicitely converting would be okay
IMO.

Michael

--
Dr. Michael Meskes, Project-Manager    | topsystem Systemhaus GmbH
meskes@topsystem.de                    | Europark A2, Adenauerstr. 20
meskes@debian.org                      | 52146 Wuerselen
Go SF49ers! Go Rhein Fire!             | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux!                  | Fax: (+49) 2405/4670-10

> -----Original Message-----
> From:    Thomas G. Lockhart [SMTP:lockhart@alumni.caltech.edu]
> Sent:    Thursday, February 05, 1998 4:40 PM
> To:    Michael Meskes
> Cc:    PostgreSQL Hacker
> Subject:    Re: [HACKERS] Bug?
>
> > I'm currently back to work with version 6.2.1 since I cannot connect
> with
> > 6.3 via ODBC.
> >
> > Anyway, I got my application running after finding a problem (inside
> the
> > app) with data conversion (it read double from a long data field).
> But it
> > seems I also encountered what I believe to be a bug. Since I'm nor
> sure
> > whether it's known I bring it up here. If I try to insert
> 199802051215 to a
> > float8 field it doesn't work because the parser believes this is a
> long and
> > truncates it to 2147...... Using 199802051215.0 to make sure it's a
> float
> > works fine. Shouldn't the parser be able to handle this?
>
> The current v6.3beta behavior is this:
>
> postgres=> select 199802051215;
> ERROR:  Bad integer input '199802051215'
>
> We had a bit of a discussion about the best way to handle this, and
> decided to
> try Bruce's solution to reject the input as a first step. I have
> patches to do
> the automatic conversion to a float, but have not applied them.
>
> The other approach would lead to an error looking like:
>
> postgres=> insert into t values (199802051215.0);
> ERROR:  pg_atoi: error reading "199802051215.000000": Math result not
> representable
>
> I can see arguments for both approaches; do you have a strong opinion
> either
> way?
>
>                                                      - Tom

Re: [HACKERS] Bug?

From
jwieck@debis.com (Jan Wieck)
Date:
>
> Is there a way to explicitely tell the parser which kind of variable we
> want? That is something like float(1) to get 1.0.

    '1'::float8

>
> It's obviously easier in Oracle (where my source came from) since they
> only have one number type. But expclicitely converting would be okay
> IMO.
>
> Michael
>
> --
> Dr. Michael Meskes, Project-Manager    | topsystem Systemhaus GmbH
> meskes@topsystem.de                    | Europark A2, Adenauerstr. 20
> meskes@debian.org                      | 52146 Wuerselen
> Go SF49ers! Go Rhein Fire!             | Tel: (+49) 2405/4670-44
> Use Debian GNU/Linux!                  | Fax: (+49) 2405/4670-10


Until later, Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #

Re: [HACKERS] Bug?

From
Michael Meskes
Date:
Jan Wieck writes:
> >
> > Is there a way to explicitely tell the parser which kind of variable we
> > want? That is something like float(1) to get 1.0.
>
>     '1'::float8

I'll try that for a complex statement. Seems I have to learn quite a lot
about postgresql. :-)

Michael

--
Dr. Michael Meskes, Project-Manager    | topsystem Systemhaus GmbH
meskes@topsystem.de                    | Europark A2, Adenauerstr. 20
meskes@debian.org                      | 52146 Wuerselen
Go SF49ers! Go Rhein Fire!             | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux!                  | Fax: (+49) 2405/4670-10