X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 94CC330E82A for ; Thu, 12 Jun 2003 11:46:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 42115-08 for ; Thu, 12 Jun 2003 08:46:47 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 9A7B330E740 for ; Thu, 12 Jun 2003 08:46:46 -0300 (ADT) Received: (qmail 1341 invoked by uid 500); 12 Jun 2003 11:49:33 -0000 Date: Thu, 12 Jun 2003 06:49:33 -0500 From: Bruno Wolff III To: pgsql-sql@postgresql.org Subject: Re: How to make a IN without a table... ? Message-ID: <20030612114933.GA1285@wolff.to> Mail-Followup-To: pgsql-sql@postgresql.org References: <20030612091914.GA680@apartia.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030612091914.GA680@apartia.fr> User-Agent: Mutt/1.5.4i X-Archive-Number: 200306/100 X-Sequence-Number: 13858 On Thu, Jun 12, 2003 at 11:19:14 +0200, David Pradier wrote: > > In short, i want to calculate the result of the function my_function for > some values of my_var1, cross by some values of my_var2. > These values are not taken in a table, but put in directly. > They are a lot, so i would prefer not to write the whole thing, line > after line. (Let's say 10 values for the first, and 40 for the second => > 400 lines of code to maintain...) If there aren't a huge number of values you can use union. (If there are a large number then you probably want to load temp tables using copy.) For example: select myval1, myval2, f(myval1,myval2) from (select '1' union select '2' union select '3') as tab1 (myval1), (select '1' union select '2' union select '3') as tab2 (myval2);