Currently PL/Proxy fails to parse following statement:
select (0*0);
As only SELECT statement is affected, fix it by explicitly checking
for that case.
In long-term, the function-call detection should be moved to parser,
thus getting rid of the hack.
Patch by Peter Eisentraut
$$ language plproxy;
select * from test_select_err('user', true);
ERROR: PL/Proxy function public.test_select_err(2): Compile error at line 5: Only one SELECT statement allowed
+create function get_zero()
+returns setof integer as $x$
+ cluster 'testcluster';
+ run on all;
+ select (0*0);
+$x$ language plproxy;
+select * from get_zero();
+ get_zero
+----------
+ 0
+(1 row)
+
select * from test_select_err('user', true);
+
+create function get_zero()
+returns setof integer as $x$
+ cluster 'testcluster';
+ run on all;
+ select (0*0);
+$x$ language plproxy;
+
+select * from get_zero();
/* function call */
+ /* hack to avoid parsing "SELECT (" as function call */
+select{SPACE}*[(] { yyless(6); BEGIN(sql); yylval.str = yytext; return SELECT; }
{IDENT}{SPACE}*[(] { BEGIN(sql); yylval.str = yytext; return FNCALL; }
/* PL/Proxy language comments/whitespace */