Re: Easier string concat in PL funcs?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Jerry Sievers <jerry(at)jerrysievers(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Easier string concat in PL funcs?
Date: 2007-10-03 16:04:59
Message-ID: 20071003160459.GG10624@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jerry Sievers wrote:
> After for the umpteenth time bashing my head against a wall developing
> some PL funcs that use dynamic SQL, going plain bonkers trying to
> build the query string; I came up with a function like the one below
> to take a string with placeholders, an array of values to be
> interpolated and a placeholder char. (This may appear Pythonish to
> some.
>
> Question: Am I overlooking a simple way of doing this?
>
> As in; raise notice 'Foo % %', v_var1, v_var2;

No, you aren't. AFAICT there isn't any way to do that, and I missed it
not too long ago.

I'm not sure about the exact syntax, and certainly I expect this to
become less of an issue with plan invalidation on 8.3, but IMHO it would
be good to have something like Python %(f)s string interpolation (or
just plain string interpolation like in other languages).

--
Alvaro Herrera http://www.advogato.org/person/alvherre
"Cuando no hay humildad las personas se degradan" (A. Christie)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Laurent ROCHE 2007-10-03 16:59:04 Generating TRUNCATE orders
Previous Message hafordjr 2007-10-03 15:59:18 Windows vista