Re: PL/pgSQL 2
От | Pavel Stehule |
---|---|
Тема | Re: PL/pgSQL 2 |
Дата | |
Msg-id | CAFj8pRB5K9+FQd7Ns6GHp1aybZ9EGPgR2m+60LzwmJ2RLjkxFA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: PL/pgSQL 2 (Craig Ringer <craig@2ndquadrant.com>) |
Список | pgsql-hackers |
2014-09-01 16:26 GMT+02:00 Craig Ringer <craig@2ndquadrant.com>:
On 09/01/2014 10:24 PM, Andres Freund wrote:Well, the idiom:
> I know of format(), but it doesn't allow you to pass parameters as
> actual query variables unfortunately.
> I'm wondering if there's a way to marry USING and format()...
EXECUTE format("SELECT %I FROM %I WHERE $1", col, tbl) USING val;
is not lovely. It works, but it's clumsy.
It is not intuitive, but It is well descriptive about PL/pgSQL. I cannot to imagine some different - it is mix of two independent worlds. And at end it is elegant.
If we start new language from scratch, then we don't need to introduce concept of embedded SQL or dynamic SQL.
But why? If it is too clumsy for you, use PLPerl or PLPython. Everytime will be problem how to merge two different namespaces together.
--
Craig Ringer http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services
В списке pgsql-hackers по дате отправления: