pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <kgrittn@ymail.com>
To: Tim Kane <tim.kane@gmail.com>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-general@postgresql.org>
Subject: Re: WHERE 'Something%' LIKE ANY (array_field)
Date: Wed, 14 Aug 2013 11:23:50 -0700 (PDT)
Message-ID: <1376504630.5670.YahooMailNeo@web162904.mail.bf1.yahoo.com> (raw)
In-Reply-To: <CADVWZZJ_=rM017iE63ETc1kCLCZGmC_mNhEoDfaJk-bTmB3ZSg@mail.gmail.com>
References: <CADVWZZJDESrQPuCj=q--PCrGVedjfJMPH__tAW8LR5b=Z+-y-A@mail.gmail.com>
	<CAFj8pRCEx45-bFiG-kFOyJxpOYsUtj03RLLFMGuBXfKS-Sp0Fw@mail.gmail.com>
	<CADVWZZJ_=rM017iE63ETc1kCLCZGmC_mNhEoDfaJk-bTmB3ZSg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>

Tim Kane <tim.kane@gmail.com> wrote:

> I'm using a single LIKE clause against an array parameter, rather
> than multiple LIKE clauses against a single parameter.

The problem is that you have the arguments to the LIKE parameter
reversed with the attempts you show.  Try something like this:

select * from ids
  where exists
   (select * from (select unnest(ids.id)) x(id)
                     where x.id like 's45%');

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



view thread (5+ messages)  latest in thread

Message-ID: <1376504630.5670.YahooMailNeo@web162904.mail.bf1.yahoo.com>
Permalink:  ../1376504630.5670.YahooMailNeo@web162904.mail.bf1.yahoo.com/
Also on:    postgresql.org/message-id/1376504630.5670.YahooMailNeo@web162904.mail.bf1.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: kgrittn@ymail.com, tim.kane@gmail.com, pavel.stehule@gmail.com
  Subject: Re: WHERE 'Something%' LIKE ANY (array_field)
  In-Reply-To: <1376504630.5670.YahooMailNeo@web162904.mail.bf1.yahoo.com>
  References: <CADVWZZJDESrQPuCj=q--PCrGVedjfJMPH__tAW8LR5b=Z+-y-A@mail.gmail.com> <CAFj8pRCEx45-bFiG-kFOyJxpOYsUtj03RLLFMGuBXfKS-Sp0Fw@mail.gmail.com> <CADVWZZJ_=rM017iE63ETc1kCLCZGmC_mNhEoDfaJk-bTmB3ZSg@mail.gmail.com> <1376504630.5670.YahooMailNeo@web162904.mail.bf1.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox