Re: PostgreSQL: Inserting NULL values adds empty string. - Mailing list pgsql-sql

From Thomas Kellerer
Subject Re: PostgreSQL: Inserting NULL values adds empty string.
Date
Msg-id n9qgjm$6dm$1@ger.gmane.org
Whole thread Raw
In response to PostgreSQL: Inserting NULL values adds empty string.  ("Venkatesan, Sekhar" <sekhar.venkatesan@emc.com>)
List 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 ''





pgsql-sql by date:

Previous
From: "Venkatesan, Sekhar"
Date:
Subject: Re: [ODBC] PostgreSQL: Inserting NULL values adds empty string.
Next
From: Adrian Klaver
Date:
Subject: Re: [ODBC] PostgreSQL: Inserting NULL values adds empty string.