Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fO0ZL-0008P2-8f for pgsql-general@arkaria.postgresql.org; Wed, 30 May 2018 12:51:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fO0ZJ-0006IW-Hf for pgsql-general@arkaria.postgresql.org; Wed, 30 May 2018 12:51:09 +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.89) (envelope-from ) id 1fO0ZJ-0006IG-6P for pgsql-general@lists.postgresql.org; Wed, 30 May 2018 12:51:09 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fO0ZB-0003mi-Ua for pgsql-general@postgresql.org; Wed, 30 May 2018 12:51:07 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id B4749D36E9DC for ; Wed, 30 May 2018 05:50:59 -0700 (MST) Date: Wed, 30 May 2018 05:50:59 -0700 (MST) From: PegoraroF10 To: pgsql-general@postgresql.org Message-ID: <1527684659736-0.post@n3.nabble.com> In-Reply-To: <1518328644815-0.post@n3.nabble.com> References: <1518328644815-0.post@n3.nabble.com> 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 Some time ago I=C2=B4ve posted this thread because we had lots of these exe= cute blocks to be translated to Postgres. Now, continuing on same matter, I woul= d like to discuss the same topic, basically calling the server one time only, instead of several times. Usually we want get some values from server and then insert or update some records based on that returned values. Each of these calls will spend time and this is the point I would like to discuss.=20 How to send a script to server and return one or more values from that execution ? You=C2=B4ll probably answer me that I could solve that with a function. But suppose those executions are dynamic, depends on businness rules or any other problem. So, is that possible to change a DO structure is ran, to be possible to return one or more values ?=20 It would be like ... DO returns(ID Integer, Description Text) as $$ begin select ...=20 insert ... select ... into ID, Description end $$ Using this way would be possible to create that script on client, call it just one time and have a result for that execution, exactly the way a "execute block" does on Firebird. Is that possible or there is a way to call just one time the server to return values without creating a function to each call ? What do you think change how DO structure is ran to have results from ? Version 12, what do you think ? -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.ht= ml