Bug in intarray?

Поиск
Список
Период
Сортировка
От Guillaume Lelarge
Тема Bug in intarray?
Дата
Msg-id 1329428628.2315.8.camel@localhost.localdomain
обсуждение исходный текст
Ответы Re: Bug in intarray?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

On a french PostgreSQL web forum, one of our users asked about a curious
behaviour of the intarray extension.

This query:
  SELECT ARRAY[-1,3,1] & ARRAY[1, 2];
should give {1} as a result.

But, on HEAD (and according to his tests, on 9.0.6 and 9.1.2), it
appears to give en empty array.

Digging on this issue, another user (Julien Rouhaud) made an interesting
comment on this line of code:

if (i + j == 0 || (i + j > 0 && *(dr - 1) != db[j]))

(line 159 of contrib/intarray/_int_tool.c, current HEAD)

Apparently, the code tries to check the current value of the right side
array with the previous value of the resulting array. Which clearly
cannot work if there is no previous value in the resulting array.

So I worked on a patch to fix this, as I think it is a bug (but I may be
wrong). Patch is attached and fixes the issue AFAICT.

Thanks.


--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Dimitri Fontaine
Дата:
Сообщение: Re: Command Triggers
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: run GUC check hooks on RESET