Re: [PERFORM] empty string Vs NULL

2015-02-09 Thread Pavel Stehule
Hi

2015-02-09 12:22 GMT+01:00 sridhar bamandlapally sridhar@gmail.com:

 Hi All

 We are testing our Oracle compatible business applications on PostgreSQL
 database,

 the issue we are facing is empty string Vs NULL

 In Oracle '' (empty string) and NULL are treated as NULL

 but, in PostgreSQL '' empty string not treated as NULL

 I need some *implicit* way in PostgreSQL where ''empty string can be
 treated as NULL


It is not possible in PostgreSQL.  PostgreSQL respects ANSI SQL standard -
Oracle not.

Regards

Pavel

p.s. theoretically you can overwrite a type operators to support Oracle
behave, but you should not be sure about unexpected negative side effects.




 Please,

 Thanks
 Sridhar BN




Re: [PERFORM] empty string Vs NULL

2015-02-09 Thread Nikolas Everett
Its been a while since I really worked with Postgres, but could you write a
trigger to convert empty string to null on save?  You'd have to carefully
apply it everywhere but it'd get you the searching for null finds empty. If
that is all you do the you've got it.

Essentially, there isn't a switch for it but you can do it with some
mechanisms.

Nik
On Feb 9, 2015 6:54 AM, Pavel Stehule pavel.steh...@gmail.com wrote:

 Hi

 2015-02-09 12:22 GMT+01:00 sridhar bamandlapally sridhar@gmail.com:

 Hi All

 We are testing our Oracle compatible business applications on PostgreSQL
 database,

 the issue we are facing is empty string Vs NULL

 In Oracle '' (empty string) and NULL are treated as NULL

 but, in PostgreSQL '' empty string not treated as NULL

 I need some *implicit* way in PostgreSQL where ''empty string can be
 treated as NULL


 It is not possible in PostgreSQL.  PostgreSQL respects ANSI SQL standard -
 Oracle not.

 Regards

 Pavel

 p.s. theoretically you can overwrite a type operators to support Oracle
 behave, but you should not be sure about unexpected negative side effects.




 Please,

 Thanks
 Sridhar BN