require exactly 1 row for non-setof functions
authorMarko Kreen <markokr@gmail.com>
Mon, 21 Jul 2008 13:50:19 +0000 (13:50 +0000)
committerMarko Kreen <markokr@gmail.com>
Mon, 21 Jul 2008 13:50:19 +0000 (13:50 +0000)
expected/plproxy_select.out
src/main.c

index 8048e9f85d3bc4324a9d090b409daff27d17e1e6..8b4c34625174d44e5e8ac3c6109e5c056c787d78 100644 (file)
@@ -24,7 +24,7 @@ select * from test_select('user', true);
 (1 row)
 
 select * from test_select('xuser', false);
-ERROR:  PL/Proxy function public.test_select(2): bug: no result
+ERROR:  PL/Proxy function public.test_select(2): Non-SETOF function requires 1 row from remote query, got 0
 -- test errors
 create function test_select_err(xuser text, tmp boolean)
 returns integer as $$
index 0b92ee0442a1cf4f4817f4d0e8f2768ab30e9bf1..d0a3672db1f3a70b0c29c75564c775977689d022 100644 (file)
@@ -211,6 +211,9 @@ plproxy_call_handler(PG_FUNCTION_ARGS)
        else
        {
                func = compile_and_execute(fcinfo);
+               if (func->cur_cluster->ret_total != 1)
+                       plproxy_error(func, "Non-SETOF function requires 1 row from remote query, got %d",
+                                                 func->cur_cluster->ret_total);
                ret = plproxy_result(func, fcinfo);
                plproxy_clean_results(func->cur_cluster);
        }