Re: Problem with void integer - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Problem with void integer
Date
Msg-id 20050530141023.GG28961@svana.org
Whole thread Raw
In response to Problem with void integer  (Alexandre Lollini <alex-admin@espacelollini.com>)
List pgsql-general
On Mon, May 30, 2005 at 03:46:09PM +0200, Alexandre Lollini wrote:
> I have a big problem to jump from 7.2 to 8.0.3
> In my application I was doing a major use of int and float
> And the difference between '0' and void NULL '' data content.
>
> Now it seems to me that void is not allowed for an integer ?

Ok, NULL, 0 (number zero) and '' (empty string) are all distinct.

Oracle considers NULL and <empty string> to be the same, which causes
confusion but that is not the problem here.

In older versions of PostgreSQL, an empty string could be converted to
an integer and would result in 0. This is contrary to SQL spec and was
changed somewhere after 7.2. The release notes from back then should
mention it somewhere.

Also, PostgreSQL no longer freely translates between integer and float,
you have to explicitly ask for a conversion that loses precision.

> What should I do ?

Some versions had a hack to fix this, but I don't think 8.0 has that
anymore... If you need more help, you need to post the query and exact
error message.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

pgsql-general by date:

Previous
From: Alexandre Lollini
Date:
Subject: Problem with void integer
Next
From: Danny Gaethofs
Date:
Subject: Postgres under Windows