Re: enhance SPI to support EXECUTE commands - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: enhance SPI to support EXECUTE commands
Date
Msg-id 20200104230528.is55vhgto34ac4dw@development
Whole thread Raw
In response to Re: enhance SPI to support EXECUTE commands  (Ahsan Hadi <ahsan.hadi@gmail.com>)
Responses Re: enhance SPI to support EXECUTE commands  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers
Hi,

On Wed, Sep 18, 2019 at 05:29:52PM +0500, Ahsan Hadi wrote:
>I don't see much use for this because the documentation says that "server's
>execute command cannot be used directly within pl/pgsql function (and it is
>not needed). Within pl/pgsql you can execute update/delete commands using
>pl/pgsql EXECUTE command and get results like row_count using "get
>diagnostic".
>
>Why would somebody do what you have shown in your example in pl/pgsql? Or
>do you have a more general use-case for this enhancement?
>

Yeah, I think that's a good question - why would we need this? In fact,
the plpgsql docs explicitly say:

   The PL/pgSQL EXECUTE statement is not related to the EXECUTE SQL
   statement supported by the PostgreSQL server. The server's EXECUTE
   statement cannot be used directly within PL/pgSQL functions (and is
   not needed).

That is because all queries in plpgsql are prepared and cached
automatically, so why would we need this feature?

In any case, the patch should probably be in "waiting on author" state,
so I'll make it that way.


registrace

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services 



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Rethinking opclass member checks and dependency strength
Next
From: Tom Lane
Date:
Subject: Re: Commit fest manager for 2020-01