From 80c644d32ea490e04c40eccaf474d63afaa7240e Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Mon, 21 Jul 2008 13:50:19 +0000 Subject: [PATCH] require exactly 1 row for non-setof functions --- expected/plproxy_select.out | 2 +- src/main.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/expected/plproxy_select.out b/expected/plproxy_select.out index 8048e9f..8b4c346 100644 --- a/expected/plproxy_select.out +++ b/expected/plproxy_select.out @@ -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 $$ diff --git a/src/main.c b/src/main.c index 0b92ee0..d0a3672 100644 --- a/src/main.c +++ b/src/main.c @@ -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); } -- 2.39.5