View Single Post

   
  #2 (permalink)  
Old 04-09-2008, 11:03 PM
Alvaro Herrera
 
Posts: n/a
Default Re: Easier string concat in PL funcs?

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)

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Reply With Quote