Re: execute block like Firebird does

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: execute block like Firebird does
Дата
Msg-id CAKFQuwaw7k84orwmvh_C+920NfSLiuZ9d2VUQMEyM2RURx3atg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: execute block like Firebird does  (PegoraroF10 <marcos@f10.com.br>)
Список pgsql-general
On Mon, Feb 12, 2018 at 6:48 AM, PegoraroF10 <marcos@f10.com.br> wrote:
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 ?

Yes, you can pass "text" SQL into a pl/pgsql function and "EXECUTE"​ it.  That text must be plain SQL though, not pl/pgsql.

Converting pl/pgsql into plain SQL and executing it as a CTE seems like an over-solution.  What should be reasonably possible to rewrite the "execute block" as a "create function" then modify your clients to do send "select * from function();" instead of "execute block ..."

If I was you I'd even be curious enough to see if maybe there is an external third-party extension "pl/firebase" language out there which would let you comfortably copy-paste the block text into the function body with minimal or no editing.

​David J.​

​p.s. reading PostGres is hard on our (mine at least) eyes.  Its either Postgres, or PostgreSQL - neither with a capital G.​

В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: execute block like Firebird does
Следующее
От: PegoraroF10
Дата:
Сообщение: Re: execute block like Firebird does