Array to IN or UNION

Поиск
Список
Период
Сортировка
От Jordi Romagos
Тема Array to IN or UNION
Дата
Msg-id 4afe29ef0902240907v219a8013j161028d8d5a6d6d3@mail.gmail.com
обсуждение исходный текст
Ответы Re: Array to IN or UNION  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
I'm doing a procedure and I'm trying to pass a dynamic array into a CURSOR, I found the sentence ANY but it's really slow. Is there any way to convert all the elements in this array to IN condition or one select with unions?
For example,

BEGIN
  example CURSOR (codes integer[] )
   SELECT *
   FROM table_1
    WHERE code IN (3,5,7)

or

  example CURSOR (codes integer[] )
   SELECT *
   FROM table_1
    WHERE codi = 3
   UNION
   SELECT *
   FROM table_1
    WHERE codi = 5
   SELECT *
   FROM table_1
    WHERE codi = 7


DECLARE

  OPEN example(ARRAY[3,5,7]);
END;


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

Предыдущее
От: najmuddin hassan
Дата:
Сообщение: Connection refused (0x0000274D/10061).
Следующее
От: John R Pierce
Дата:
Сообщение: Re: postgresql with storage