X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 0B9C8F0101 for ; Sun, 8 Jun 2003 11:09:00 +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 26136-03 for ; Sun, 8 Jun 2003 11:08:49 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 0F351F00CE for ; Sun, 8 Jun 2003 11:08:33 +0000 (GMT) Received: (qmail 14349 invoked by uid 500); 8 Jun 2003 11:11:13 -0000 Date: Sun, 8 Jun 2003 06:11:13 -0500 From: Bruno Wolff III To: pgsql-sql@postgresql.org Subject: Re: How to make a IN without a table... ? Message-ID: <20030608111113.GA14337@wolff.to> Mail-Followup-To: pgsql-sql@postgresql.org References: <20030604145901.GB766@apartia.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030604145901.GB766@apartia.fr> User-Agent: Mutt/1.5.4i X-Archive-Number: 200306/61 X-Sequence-Number: 13819 On Wed, Jun 04, 2003 at 16:59:02 +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...) > > I really don't see how to do this :-/ You could programatically generate the sql code and use union (e.g. (select 1 union select 2 union select 3 union select 4)) to join the rows together or you could write a set returning function.