Re: Problem with void integer

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Alexandre Lollini <alex2(at)espacelollini(dot)com>
Cc: Postgresql General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Problem with void integer
Date: 2005-05-30 19:05:36
Message-ID: 20050530190532.GA2481@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Please reply to the list so everyone can follow the discussion:

On Mon, May 30, 2005 at 07:50:03PM +0200, Alexandre Lollini wrote:
> Here is my query sample (exact):

<snip>

> INSERT INTO sometable ( someint4field ) VALUES ( '' );
>
> To work.

Sorry, an empty string is not an integer. If you want NULL, say NULL.

> Or find me another syntax to insert '' in an integer field.
> With POSTGRESQL 803
>
> What I do not understand is why, when I "/i dump.txt" the data from my 7.2
> dump
> All the void integers '' where set correctly.

What do you mean? In 7.2 there is no integer displayed as '', only 0
and NULL. That '' used to convert to zero is *wrong* and won't be
changed back, sorry...

> Now at run time impossible to insert a void integer.

What is a "void integer"? You have either NULL or 0, there have never
been any other choices.

> For the moment I have modified all the application to convert void to zero
> prior to insert/update
>
> This is NOT the expected behavior, but, I am forced to, to preserve run
> time.

This *is* expected behaviour, an empty string is not zero, end of
story.

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

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2005-05-30 20:30:25 Re: CREATE TEMP TABLE AS SELECT/ GET DIAGNOSTICS ROW_COUNT
Previous Message Andrus 2005-05-30 18:47:43 Connecting to Postgres from LAN