Re: ...where 'value' = array[]

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ...where 'value' = array[]
Дата
Msg-id 6488.1239921155@sss.pgh.pa.us
обсуждение исходный текст
Ответ на ...where 'value' = array[]  (zach cruise <zachc1980@gmail.com>)
Список pgsql-general
zach cruise <zachc1980@gmail.com> writes:
> but i need to select group_name where state_abbreviation is in
> group_array, something like:
> select group_name from group where 'CA' = any(group_array);

Yeah?  What's the problem?

regression=# create table g (group_name text, group_array text[]);
CREATE TABLE
regression=# insert into g values ('west', '{CA,WA}');
INSERT 0 1
regression=# insert into g values ('east', '{NY,MA}');
INSERT 0 1
regression=# select * from g where 'CA' = any(group_array);
 group_name | group_array
------------+-------------
 west       | {CA,WA}
(1 row)

This has worked since 7.4 or so ...

            regards, tom lane

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

Предыдущее
От: zach cruise
Дата:
Сообщение: ...where 'value' = array[]
Следующее
От: Selena Deckelmann
Дата:
Сообщение: Volunteers needed to help staff the PostgreSQL Booth at Linux Fest North West