X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E97CF329F1F for ; Wed, 20 Oct 2004 01:14:10 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72416-10 for ; Wed, 20 Oct 2004 00:13:58 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 7D4FC32A1BA for ; Wed, 20 Oct 2004 01:14:01 +0100 (BST) Received: (qmail 25019 invoked from network); 20 Oct 2004 02:14:03 +0200 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 20 Oct 2004 02:14:03 +0200 Date: Wed, 20 Oct 2004 02:14:40 +0200 To: pgsql-sql@postgresql.org Subject: Re: need query advice References: <4170E524.2040101@kuehlbox.de> From: =?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <4170E524.2040101@kuehlbox.de> User-Agent: Opera M2/7.54 (Linux, build 751) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/135 X-Sequence-Number: 19238 argh, you could use contribs/intarray with a gist index... instead of N columns use an integer[] and gist-index it, then write the equivalent of : where (intersection of the search array with the data array) has at least 5 elements (or 4 elements) (or at least 4 elements order by the number of elements desc) in your table defs, you can express your unicity constraint on the array with : CHECK( uniq(yourarrau) = yourarrau AND length(yourarrau)=6 )