The following bug has been logged online:

Bug reference:      4613
Logged by:          Valentine Gogichashvili
Email address:      val...@gmail.com
PostgreSQL version: 8.3.1
Operating system:   Debian Linux  (kernel 2.6.8)
Description:        intarray_del_elem returns an invalid empty array (for
nullif comparison)
Details: 

I have checked the issue on the 8.2.1 and 8.3.1 by now. 

When contrib/intarray module - operation (intarray_del_elem) returns an
empty array, is not supposed to be empty 

testdb=# select 

'{ -1 }'::integer[] - ( -1 ) as calculated_empty_int_array, 

nullif( '{ -1 }'::integer[] - ( -1 ), '{}'::integer[]) as should_be_null, 

nullif( '{}'::integer[], '{}'::integer[]) as
works_for_initially_empty_array, 

nullif( '{ }'::integer[] - ( -1 ), '{}'::integer[]) as also_works;

 calculated_empty_int_array | should_be_null |
works_for_initially_empty_array | also_works
----------------------------+----------------+------------------------------
---+------------
 {}                         | {}             |                              
  |
(1 row)

So if we try to nullif an empty array, that was generated by the - operator
'{-1}'::integer[] - (-1), it does not see the array is empty. 

With best regards, 

-- Valentine Gogichashvili

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to