Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1elET6-0006pl-Cy for pgsql-general@arkaria.postgresql.org; Mon, 12 Feb 2018 13:48:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elET5-0007p5-E9 for pgsql-general@arkaria.postgresql.org; Mon, 12 Feb 2018 13:48:27 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1elET5-0007ot-3V for pgsql-general@lists.postgresql.org; Mon, 12 Feb 2018 13:48:27 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1elET1-0006dG-19 for pgsql-general@postgresql.org; Mon, 12 Feb 2018 13:48:24 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 93A07B1D1F3F for ; Mon, 12 Feb 2018 06:48:21 -0700 (MST) Date: Mon, 12 Feb 2018 06:48:21 -0700 (MST) From: PegoraroF10 To: pgsql-general@postgresql.org Message-ID: <1518443301602-0.post@n3.nabble.com> In-Reply-To: <9fa5f7c2-b6ca-ccfd-fded-284359f973c4@gelassene-pferde.biz> References: <1518328644815-0.post@n3.nabble.com> <9fa5f7c2-b6ca-ccfd-fded-284359f973c4@gelassene-pferde.biz> Subject: Re: execute block like Firebird does MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk We can change all those execute blocks, but it would be a huge work if we need to rewrite them all. Today, just for a test, I replaced a Firebird execute block to a Postgres CTE. OK, worked but I spend 40 minutes and the problem is that we have hundreds of these execute blocks and on each one we need to rethink, rewrite, retest.=20 When we changed all our triggers and procedures from Firebird to PostGres w= e needed only to rewrite "first 1" to "limit 1", "starting with" to "like" as examples. So, just a Search and Replace will do solve it. And now if PostGres doesn=C2=B4t have something similar to Execute Block we= have to change lots of things. As you may know, change a function body to a CTE is not so trivial. Another approach to solve my problem would be a function that receives a dynamic SQL, runs it and returns a XML or JSON and on client side I convert that XML back to a recordset. Is that possible ? -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.ht= ml