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

From Craig Ringer
Subject Re: PL/pgSQL 2
Date
Msg-id 5404822A.7040008@2ndquadrant.com
Whole thread Raw
In response to Re: PL/pgSQL 2  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: PL/pgSQL 2
Re: PL/pgSQL 2
List pgsql-hackers
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.

-- Craig Ringer                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: PL/pgSQL 2
Next
From: Joel Jacobson
Date:
Subject: Re: PL/pgSQL 2