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 43300D1CA6C for ; Tue, 9 Mar 2004 05:37:43 +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 20615-05 for ; Tue, 9 Mar 2004 01:37:40 -0400 (AST) Received: from millenium.mst.co.jp (unknown [210.230.185.241]) by svr1.postgresql.org (Postfix) with ESMTP id 01255D1B53C for ; Tue, 9 Mar 2004 01:37:39 -0400 (AST) Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id i295bXv21790; Tue, 9 Mar 2004 14:37:33 +0900 Message-ID: <00d201c40598$9d96cc50$7201a8c0@mst1x5r347kymb> From: "Iain" To: , References: <404C7EE3.8010006@yahoo.com.br> <20040308184440.GG588@64.81.242.180> <404D4667.10206@yahoo.com.br> Subject: Re: Simple SQL question Date: Tue, 9 Mar 2004 14:37:30 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/73 X-Sequence-Number: 17172 Sorry, did I write "ANALYSE SELECT .... "? It's supposed to be "EXPLAIN [ANALYSE] [VERBOSE] SELECT ..." ----- Original Message ----- From: "Daniel Henrique Alves Lima" To: Sent: Tuesday, March 09, 2004 1:21 PM Subject: Re: [SQL] Simple SQL question > 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 > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match