| From: | Oleg Bartunov <obartunov(at)gmail(dot)com> |
|---|---|
| To: | Alex Magnum <magnum11200(at)gmail(dot)com> |
| Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Searching array for multiple items |
| Date: | 2017-01-25 08:39:11 |
| Message-ID: | CAF4Au4wHkCQkR-rNB3wCQKyZwtUcE5tj04867043ZoT+Zw0Zxw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Wed, Jan 25, 2017 at 11:29 AM, Alex Magnum <magnum11200(at)gmail(dot)com> wrote:
> Hi,
> I can search an array with 1 = ANY('{1,3,4,7}'::int[])
>
> I need to check for one or multiple items in the array.
>
> e.g. '1,7,3' = ANY('{1,3,4,7}'::int[]
>
> I do need to check if
> a) all items exist in the array
> b) at least one item exists in the array
>
> Is there a an operator that allows me to do these two?
> Does the order of left and right side matter?
> Right now I have a small function but I guess there is a more efficient
> way.
>
Look on our contrib/intarray
>
> Thanks for any help.
>
> A
>
>
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Thomas Kellerer | 2017-01-25 08:47:56 | Re: Searching array for multiple items |
| Previous Message | Alex Magnum | 2017-01-25 08:29:35 | Searching array for multiple items |