X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 423635E40BA for ; Sat, 28 Aug 2004 12:13:46 -0300 (ADT) 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 98818-10 for ; Sat, 28 Aug 2004 15:13:44 +0000 (GMT) Received: from pillette.com (adsl-67-119-5-202.dsl.snfc21.pacbell.net [67.119.5.202]) by svr1.postgresql.org (Postfix) with ESMTP id DA3CD5E46C3 for ; Sat, 28 Aug 2004 12:13:35 -0300 (ADT) Received: (from andrew@localhost) by pillette.com (8.11.6/8.11.6) id i7SFDbh04877; Sat, 28 Aug 2004 08:13:37 -0700 Date: Sat, 28 Aug 2004 08:13:37 -0700 From: andrew@pillette.com Message-Id: <200408281513.i7SFDbh04877@pillette.com> Subject: Re: ill-planned queries inside a stored procedure To: Gaetano Mendola Cc: "pgsql-performance@postgresql.org" X-Originating-IP: 64.163.213.183 X-Mailer: Webmin 0.940 MIME-Version: 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.5 tagged_above=0.0 required=5.0 tests=NO_REAL_NAME, RCVD_IN_DSBL, RCVD_IN_SORBS_MISC X-Spam-Level: * Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Archive-Number: 200408/413 X-Sequence-Number: 8049 I use "EXECUTE" inside a stored procedure for just this purpose. This is not the same as PREPARE/EXECUTE, it lets you send an arbitrary string as SQL within the procedure. You have to write the query text on the fly in the procedure, which can be a little messy with quoting and escaping. Gaetano Mendola wrote .. > Hi all, > do you know any clean workaround at ill-planned queries inside a stored > procedure?