<div dir="ltr"><p><b>Description:</b><br /><p>By pgsql 8.4 I have the following bug:<br /><p>If the haystack array is
null(for example by empty result of array_agg) by is contained by, and you use it with negation, the the result is
falseinstead of true.<span><span class=""></span></span><p><br /><b>Reproduce:</b><p><span><span>The following query
returnsnothing, but it should return 1.<br /></span></span><p><span><i><span
class="">SELECT</span><span> 1 </span><spanclass="">FROM</span><span> </span><span
class="">NOT</span><span>(ARRAY[1] <@NULL</span></i><span><i>); </i></span></span><p><b>Workaround:</b><span><span
class=""><br/></span></span><p><span><i><span class="">SELECT</span><span> 1 </span><span class="">FROM (haystack IS
NULLOR</span><span> </span><span class="">NOT</span><span>(ARRAY[1] <@
</span></i></span><span><i><span><span><i><spanclass="">haystack</span></i></span></span></i><span><i>)); </i><br
/></span></span></div>