Re: issue with integer nullable column and value 0

From: Sean Hsien <umphy27(at)gmail(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: issue with integer nullable column and value 0
Date: 2009-10-15 00:07:57
Message-ID: 6679f1290910141707u57eee8dy91d2513d0d23107f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I'm using CentOS 5.2 64-bits with postgres 8.1.11 + java 6u16, and
Windows Vista 32-bits with postgres 8.4.1 + java 6u13.

Here is a small code snippet that shows the problem, where the user id
value is 0:

public void update(EntityVO vo) {
StringBuilder sql = new StringBuilder();
sql.append("UPDATE nvt_entity" +
" SET user_id = ?" +
" WHERE entity_id = ?");

Object args[] = {
vo.getUserId() == -1 ? null : vo.getUserId(),
vo.getEntityId()
};

getJdbcTemplate().update(sql.toString(), args);
}

Thanks for your time.

2009/10/15 Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>:
> Sean Hsien <umphy27(at)gmail(dot)com> wrote:
>
>> using the latest JDBC driver type 4.
>
>> I have a nullable integer column in one of my tables. When I'm
>> updating the column in 8.4 Windows with value 0, it stays as null,
>> but on the Linux 8.1 it will try to update it with the value 0.
>
> Could you post a small, self-contained example of code which exhibits
> this problem?  Also, what are the OS and Java versions on the client
> side?
>
> -Kevin
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message cf of 2009-10-15 07:45:26 BUG #5117: Table type Function Bug when column dropped
Previous Message Tom Lane 2009-10-14 22:49:37 Re: BUG #5116: could not determine encoding for locale