X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6BD11D1DCF5 for ; Tue, 9 Mar 2004 04:12:45 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 99358-08 for ; Tue, 9 Mar 2004 00:12:42 -0400 (AST) Received: from localhost.localdomain (unknown [200.245.23.5]) by svr1.postgresql.org (Postfix) with ESMTP id CA3D9D1DC2A for ; Tue, 9 Mar 2004 00:12:38 -0400 (AST) Received: from yahoo.com.br (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id i294Lx3C002812 for ; Tue, 9 Mar 2004 01:22:01 -0300 Message-ID: <404D4667.10206@yahoo.com.br> Date: Tue, 09 Mar 2004 01:21:59 -0300 From: Daniel Henrique Alves Lima Reply-To: email_daniel_h@yahoo.com.br User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: Simple SQL question References: <404C7EE3.8010006@yahoo.com.br> <20040308184440.GG588@64.81.242.180> In-Reply-To: <20040308184440.GG588@64.81.242.180> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/66 X-Sequence-Number: 17165 Thank you, Jeremy. I've built a function that returns a string from (cd_teacher, cd_course) and i've create a functional index over this function, like : create index teacher_course_idx on teacher_course (build_unique_2p(cd_teacher,cd_course)); select * from teacher_course where build_unique_2p(cd_teacher,cd_course) in ('1:2','23:11','563','341'); Is it possible to use "array cast" over cd_teacher and cd_course (just an idea, i don't known the sintaxe), like: select * from teachar_course where cast((cd_teacher,cd_course) as array) in ('{1,2}','{23,11}','{563,341}'); ? I'm using postgreSQL 7.34 Thanks !!! Jeremy Semeiks wrote: >You could use a subselect of unions: > >select * from teacher_course where (cd_course, cd_teacher) in >(select 1, 2 union select 23, 11 union select 563, 341) > >Maybe there's a more concise way, though. > >- Jeremy > > >