X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E27675551D for ; Thu, 24 Feb 2005 17:28:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23800-03 for ; Thu, 24 Feb 2005 17:28:51 +0000 (GMT) Received: from anchor-post-32.mail.demon.net (anchor-post-32.mail.demon.net [194.217.242.90]) by svr1.postgresql.org (Postfix) with ESMTP id C4BEA55486 for ; Thu, 24 Feb 2005 17:28:50 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-32.mail.demon.net with esmtp (Exim 4.42) id 1D4MnK-000KKD-6h; Thu, 24 Feb 2005 17:29:00 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 9035418124; Thu, 24 Feb 2005 17:28:41 +0000 (GMT) Message-ID: <421E0ECA.7090403@archonet.com> Date: Thu, 24 Feb 2005 17:28:42 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Steve - DND Cc: pgsql-sql@postgresql.org Subject: Re: Junk queries with variables? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.063 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/316 X-Sequence-Number: 20426 Steve - DND wrote: >>Michael's given you one option - another to look at is PREPARE/EXECUTE >>PREPARE my_query(int4) AS INSERT INTO foo VALUES ($1); >>EXECUTE my_query(1); >>EXECUTE my_query(7); >>... > > > This doesn't seem to be quite what I'm looking for. PREPARE according to the > docs is for a one line statement. I'm looking for the ability to do multiple > operations, basically using it for general DB queries that aren't really > needed more than once. This again comes from my MSSQL background where you > can go to town and just start writing out TSQL to do one off queries. Well, if psql vars, prepare or functions don't meet your needs, I'm not sure we've got anything that will. Have you got a specific example where these don't suit your needs? -- Richard Huxton Archonet Ltd