BUG #4613: intarray_del_elem returns an invalid empty array (for nullif comparison)

From: "Valentine Gogichashvili" <valgog(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4613: intarray_del_elem returns an invalid empty array (for nullif comparison)
Date: 2009-01-13 14:52:00
Message-ID: 200901131452.n0DEq0QA095679@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4613
Logged by: Valentine Gogichashvili
Email address: valgog(at)gmail(dot)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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2009-01-13 16:18:58 Re: [BUGS] Status of issue 4593
Previous Message Kev 2009-01-13 13:57:24 postgres 8.4