Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U39XH-0003cu-H8 for pgsql-sql@arkaria.postgresql.org; Wed, 06 Feb 2013 18:15:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U39XG-0000qB-Cx for pgsql-sql@arkaria.postgresql.org; Wed, 06 Feb 2013 18:15:54 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U39XF-0000pl-Dt for pgsql-sql@postgresql.org; Wed, 06 Feb 2013 18:15:53 +0000 Received: from smtp.netmosphere.net ([209.44.110.6]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U39XD-000484-Kq for pgsql-sql@postgresql.org; Wed, 06 Feb 2013 18:15:52 +0000 Received: from [10.11.0.168] (modemcable198.246-70-69.static.videotron.ca [69.70.246.198]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.netmosphere.net (Postfix) with ESMTP id 885D921A007B for ; Wed, 6 Feb 2013 13:15:46 -0500 (EST) From: Francois Payette Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: create an index on unnest Date: Wed, 6 Feb 2013 13:15:42 -0500 Message-Id: <2C875257-053D-4C81-B3ED-2EC01DF38743@netmosphere.net> To: pgsql-sql@postgresql.org Mime-Version: 1.0 (Apple Message framework v1283) X-Mailer: Apple Mail (2.1283) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Greetings! I need the following: create an index on multiple values for a single row. = My other solution consists of a lot of duplicated rows in seperate tables a= nd triggers and indexes, resulting in slower performance. The following fails on 9.2, it says ERROR: index expression cannot return = a set. drop table if exists test; create table test (id serial, data text ); insert into test VALUES(DEFAULT, 'testdata'); drop function if exists testfct(); CREATE OR REPLACE FUNCTION testfct(text) RETURNS text[] AS $$ DECLARE result text[]; BEGIN result =3D array_fill(''::text, ARRAY[1]); result[0] =3D $1 || '-one'; result[1] =3D $1 || '-two'; RETURN result; END; $$ LANGUAGE plpgsql; create index test_idx on test (unnest(testfct(data))); any suggestions? TIA, F --=20 Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql