Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 86344B5DC6E for ; Wed, 31 Aug 2011 07:32:07 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 51197-02 for ; Wed, 31 Aug 2011 10:32:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id 97FF4B5DBE0 for ; Wed, 31 Aug 2011 07:31:58 -0300 (ADT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Qyi5I-00076M-66 for pgsql-sql@postgresql.org; Wed, 31 Aug 2011 12:31:52 +0200 Received: from ip-118-90-88-84.xdsl.xnet.co.nz ([118.90.88.84]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 31 Aug 2011 12:31:52 +0200 Received: from jasen by ip-118-90-88-84.xdsl.xnet.co.nz with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 31 Aug 2011 12:31:52 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Jasen Betts Subject: Re: where col1 not ilike ('str1%', 'str2%'... 'strN%') support? Date: 31 Aug 2011 10:17:50 GMT Organization: Dis (not Dat) Organisation Lines: 29 Message-ID: References: <4E5CF8F8.7030404@encs.concordia.ca> <16967.1314717876@sss.pgh.pa.us> <4E5D0656.8090709@encs.concordia.ca> <17497.1314719596@sss.pgh.pa.us> <4E5D0856.105@encs.concordia.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: ip-118-90-88-84.xdsl.xnet.co.nz X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-18 (Linux) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201108/126 X-Sequence-Number: 35794 On 2011-08-30, Emi Lu wrote: > Hi Tom, > >>>> select * from tablename >>>> where not (col1 ~~* any(array['str1%', 'str2%'... 'strN%'])); >> >>> If next version could have "not ilike ('', '')" added into window >>> functions, that's will be great! >> >> Why? And what's this got to do with window functions? > > First, where not (col1 ~~* any(array['str1%', 'str2%'... 'strN%'])) will > work for me. > > But I feel " ilike ('str1', ... 'strN')" is more intuitive, isn't it? no, "('str1', ... 'strN')" looks a lot like a tuple. if you know these strings beforehand use a single regular expression instead because ilike is just regex in drag (postgres uses regex to do ilike), and while ilike can only check one pattern at a time regex can check several simultaneously. foo ~* '^(str1|str2|str3...|strN)$' -- ⚂⚃ 100% natural