Search Postgresql Archives

Re: references/tutorial/tricks on dynamic generation of sql (& plpgsql functions) editing/coding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I'm using pg 7.4 so $$ trick shouldn't work.
Should work. if you put enugh $$, somebody might backport this for you ;)


how about:

create or replace function SP_GarbageCollectionGenerate()
returns bool as '
declare
v_query text;
begin
    v_qyery=''create or replace blah blah 
    :para1 blah blah
    blah blah :para2
    '';
    v_query=replace(v_query,'':para1'',quote_literal(value_1));
    v_query=replace(v_query,'':para2'',quote_ident(value_2));
    execute v_query;
    
end;
' language plpgsql;

a bit more readable, I think.

Greetings
Marcin


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux