Re: Problem with void integer

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Alexandre Lollini <alex-admin(at)espacelollini(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with void integer
Date: 2005-05-30 14:10:27
Message-ID: 20050530141023.GG28961@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Danny Gaethofs 2005-05-30 14:13:14 Postgres under Windows
Previous Message Alexandre Lollini 2005-05-30 13:46:09 Problem with void integer