[GENERAL] 9.4+ partial log-shipping possible?

2015-03-26 Thread Sven Geggus
Hello, I have a question regarding log-shipping replication, but let me first explain what I currently do. Usually Openstreetmap Tile Servers are currently set up using a PostgreSQL/Postgis Database which stores the data need for rendering raster map-tiles. After the initial import of a complete

[GENERAL] PL/pgSQL: How to return two columns and multiple rows

2015-06-18 Thread Sven Geggus
Hello, I supose this is simple, but I did not find a solution in the documentation. I would like to be able to do something like this: select myfunc('foo','bar'); or select myfunc(foo, bar) from foobartable; or even select myfunc(foo, bar), 'baz' as baz from foobartable; Which should return som

Re: [GENERAL] PL/pgSQL: How to return two columns and multiple rows

2015-06-18 Thread Sven Geggus
David G. Johnston wrote: > Look at the "returns table (col1 type, col2 type)" form. If I got this right "returns table" is not what I want as I need to select from my function as a virtual table in this case. Regards Sven -- "Thinking of using NT for your critical apps?

Re: [GENERAL] PL/pgSQL: How to return two columns and multiple rows

2015-06-18 Thread Sven Geggus
Pavel Stehule wrote: > CREATE OR REPLACE FUNCTION public.fx(i integer, OUT a text, OUT b text) > RETURNS SETOF record > LANGUAGE plpgsql > AS $function$ > BEGIN > RETURN QUERY SELECT 'foo'||id, 'bar'||id FROM generate_series(1,i) g(id); > RETURN; > END; > $function$ I'm afraid I will almos

Re: [GENERAL] PL/pgSQL: How to return two columns and multiple rows

2015-06-18 Thread Sven Geggus
Raymond O'Donnell wrote: >> mydb=> select myfunc('foo','bar'); > > You need to do: > >select * from myfunc('foo','bar'); This has been a misguided example. Reality should more likely look like this: select myfunc(col1,col2) from mytable; And it would of course be undesired if myfunc woul

Re: [GENERAL] PL/pgSQL: How to return two columns and multiple rows

2015-06-18 Thread Sven Geggus
David G. Johnston wrote: > WITH exec_func AS ( SELECT myfunc(col1,col2) FROM mytable ) > SELECT (exec_func.myfunc).* FROM exec_func; > > This relies on the fact that currently a CTE introduces an optimization > barrier. Hm, let me summarize. My function seems to work as expected and is only call

Re: [GENERAL] PL/pgSQL: How to return two columns and multiple rows

2015-06-18 Thread Sven Geggus
David G. Johnston wrote: > Assuming you are on 9.3+ what you want to use is LATERAL OK, how is such a query supposed to look like? assuming "select myfunc(col1,col2) from mytable" works as the inner select? Sven -- Software patents are the software project equivalent of land mines: Each desi