Re: [PERFORM] <empty string> Vs NULL

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: [PERFORM] <empty string> Vs NULL
Date: 2015-02-10 05:02:37
Message-ID: 1423544557197-5837308.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-performance

sridhar bamandlapally wrote
> In application code is
>
> while inserting/updating: INSERT/UPDATE into ... ( '' ) - which is empty
> string in PG, and in Oracle its NULL
>
> while selecting: SELECT ... WHERE column IS NULL / NOT NULL
>
> the issue is, while DML its empty string and while SELECT its comparing
> with NULL

If this is the extent of your problem then you can add table triggers to
change the empty-string input so that the result of the insert/update is
NULL. Then all of your selects can use IS NULL for their comparisons just
like they do now.

That is as "implicit" as you are going to get without actually fixing the
underlying problem.

David J.

--
View this message in context: http://postgresql.nabble.com/empty-string-Vs-NULL-tp5837188p5837308.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Harshad Adalkonda 2015-02-10 05:38:58 Re: How to upgrade psql client
Previous Message Scott Ribe 2015-02-10 04:50:42 Re: [PERFORM] <empty string> Vs NULL

Browse pgsql-performance by date

  From Date Subject
Next Message Florent Guillaume 2015-02-10 10:07:05 Re: [PERFORM] <empty string> Vs NULL
Previous Message Scott Ribe 2015-02-10 04:50:42 Re: [PERFORM] <empty string> Vs NULL