Re: ANY for Array value check

Поиск
Список
Период
Сортировка
От Jasen Betts
Тема Re: ANY for Array value check
Дата
Msg-id isveae$knm$1@reversiblemaps.ath.cx
обсуждение исходный текст
Ответ на ANY for Array value check  (Emi Lu <emilu@encs.concordia.ca>)
Список pgsql-sql
On 2011-06-10, Emi Lu <emilu@encs.concordia.ca> wrote:
> Good morning,
>
> String array compare command, I forgot how to do it.
>
> E.g.,
> create table z_drop(id varchar[]);
> insert into z_drop values('{"a1", "a2", "b1", "b2", "b3"}');
>
> I'd like to do:
>
> select * from z_drop where id = any('a1', 'b1');

use the array overlap operator:

select * from z_drop where   id  &&  ARRAY['a1'::varchar, 'b1'];


If you define the column as text[] instead of varchar you don't need
the ::varchar cast above.  there's no postgres reason to prefer
(unbounded) varchar to text. 

-- 
⚂⚃ 100% natural



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

Предыдущее
От: Samuel Gendler
Дата:
Сообщение: Re: Returning a set of dates
Следующее
От: Leif Biberg Kristensen
Дата:
Сообщение: Subselects not allowed?