Re: PL/pgSQL 2 - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: PL/pgSQL 2
Date
Msg-id CAFj8pRB5K9+FQd7Ns6GHp1aybZ9EGPgR2m+60LzwmJ2RLjkxFA@mail.gmail.com
Whole thread Raw
In response to Re: PL/pgSQL 2  (Craig Ringer <craig@2ndquadrant.com>)
List 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:
> 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()...

Well, the idiom:

  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 by date:

Previous
From: Joel Jacobson
Date:
Subject: Re: PL/pgSQL 2
Next
From: Hannu Krosing
Date:
Subject: Re: PL/pgSQL 2