Array with Subselect / ANY - cast?

Поиск
Список
Период
Сортировка
От Josh Trutwin
Тема Array with Subselect / ANY - cast?
Дата
Msg-id 20070821124904.3768fb36@sinkhole.intrcomm.net
обсуждение исходный текст
Ответы Re: Array with Subselect / ANY - cast?
Re: Array with Subselect / ANY - cast?
Список pgsql-general
Hi - I have the following array field:

SELECT pb_ids FROM pb WHERE id = 123:

         pb_id
-----------------------
 {196,213,215,229,409}

These numbers map to a productid in tblproducts so I figured I could
do this:

SELECT *
  FROM tblproducts
 WHERE productid = ANY (
       SELECT pb_ids FROM pb WHERE id=123
 );

This complains: "ERROR:  operator does not exist: integer =
integer[]".

This doesn't seem much different than the example in the docs:

SELECT * FROM sal_emp WHERE 10000 = ANY (pay_by_quarter);

If I do this:

SELECT *
  FROM tblproducts
 WHERE productid = ANY ('{196,213,215,229,409}'});

The query runs fine.

Any ideas on how to make this work?

Thanks!

Josh

P.S.  Postgres 8.1.9 on Linux

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

Предыдущее
От: "Harald Armin Massa"
Дата:
Сообщение: Re: Question on INDEX and SQL - stalling my database?
Следующее
От: "Pavel Stehule"
Дата:
Сообщение: Re: Array with Subselect / ANY - cast?