Re: PostgreSQL: Inserting NULL values adds empty string.

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: PostgreSQL: Inserting NULL values adds empty string.
Date: 2016-02-14 18:21:43
Message-ID: n9qgjm$6dm$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc pgsql-sql

Venkatesan, Sekhar schrieb am 14.02.2016 um 14:13:
>
> I am using PostgreSQL 9.4 odbc driver to talk to 9.4 postgreSQL server.
> I see that when inserting NULL values into DB is adding empty string in the database only in windows.
> The same insert is adding NULL values into database when linux odbc driver is used to connect to linux database.
> Is there any configuration in odbc driver end or in server to retain the null values or is it a bug?
> If it is not and is an expected behavior, how to fix it in the application?
>
> Thanks,
> Sekhar

The server most definitely will not convert a NULL value into an empty string out of the blue.
So it's either the ODBC driver (which I highly doubt) or your application.

Another possible reason is a trigger that converts nulls to empty strings.

Can you show us the insert that is used to store the NULL values?
Are you explicitely listing that column and providing a NULL value?

Or are you maybe not passing a value for that column at all?
In that case the column might be defined as DEFAULT ''

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Adrian Klaver 2016-02-14 18:36:36 Re: PostgreSQL: Inserting NULL values adds empty string.
Previous Message Venkatesan, Sekhar 2016-02-14 18:08:54 Re: PostgreSQL: Inserting NULL values adds empty string.

Browse pgsql-sql by date

  From Date Subject
Next Message Adrian Klaver 2016-02-14 18:36:36 Re: PostgreSQL: Inserting NULL values adds empty string.
Previous Message Venkatesan, Sekhar 2016-02-14 18:08:54 Re: PostgreSQL: Inserting NULL values adds empty string.