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 45E4230DE47 for ; Fri, 13 Jun 2003 21:22:54 +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 04485-08 for ; Fri, 13 Jun 2003 18:22:43 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 1D76930DCE2 for ; Fri, 13 Jun 2003 18:22:43 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h5DLMN4w000633; Fri, 13 Jun 2003 15:22:23 -0600 (MDT) Date: Fri, 13 Jun 2003 15:04:14 -0600 (MDT) From: "scott.marlowe" To: David Pradier Cc: Christoph Haller , Subject: Re: How to make a IN without a table... ? In-Reply-To: <20030612115027.GB680@apartia.fr> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Archive-Number: 200306/130 X-Sequence-Number: 13888 On Thu, 12 Jun 2003, David Pradier wrote: > On Thu, Jun 12, 2003 at 01:16:27PM +0200, Christoph Haller wrote: > > > > > > i ran today in a problem when doing some (i mean too much for me) > > advanced sql... > > > > > > What i want to do is something like this: > > > > > > SELECT > > > my_var1, > > > my_var2, > > > my_function(my_var1, my_var2) > > > FROM ( > > > SELECT > > > '1', > > > '2', > > > '3', > > > '4' > > > ) AS my_var1_values, > > > ( > > > SELECT > > > '1', > > > '2', > > > '3', > > > '4' > > > ) AS my_var2_values > > > > > > 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 :-/ > > > > > What about using a TEMP TABLE? > > I avoid as hell to use temporary tables. This is part of a complex > database, with more than 250 different tables. So i don't even want to > think about adding temporary tables, brrr ! Just FYI, temporary tables in pgsql are invisible to other connections even if they have the same name, and are auto-dropped when the connection is dropped.