1 | 3
(1 row)
+-- test simple hash
+\c test_part
+create function test_simple(partno int4) returns int4
+as $$ begin return $1; end; $$ language plpgsql;
+\c regression
+create function test_simple(partno int4) returns int4
+as $$
+ cluster 'testcluster';
+ run on $1;
+$$ language plproxy;
+select * from test_simple(0);
+ test_simple
+-------------
+ 0
+(1 row)
+
+drop function test_simple(int4);
+create function test_simple(partno int4) returns int4
+as $$
+ cluster 'testcluster';
+ run on partno;
+$$ language plproxy;
+select * from test_simple(0);
+ test_simple
+-------------
+ 0
+(1 row)
+
as $$ cluster 'testcluster'; run on 0; $$ language plproxy;
select * from test_difftypes('types');
+-- test simple hash
+\c test_part
+create function test_simple(partno int4) returns int4
+as $$ begin return $1; end; $$ language plpgsql;
+\c regression
+create function test_simple(partno int4) returns int4
+as $$
+ cluster 'testcluster';
+ run on $1;
+$$ language plproxy;
+select * from test_simple(0);
+drop function test_simple(int4);
+
+create function test_simple(partno int4) returns int4
+as $$
+ cluster 'testcluster';
+ run on partno;
+$$ language plproxy;
+select * from test_simple(0);
+
| NUMBER { xfunc->run_type = R_EXACT; xfunc->exact_nr = atoi($1); }
| ANY { xfunc->run_type = R_ANY; }
| ALL { xfunc->run_type = R_ALL; }
+ | hash_direct { xfunc->run_type = R_HASH; }
;
+hash_direct: IDENT { hash_sql = plproxy_query_start(xfunc, false);
+ cur_sql = hash_sql;
+ plproxy_query_add_const(cur_sql, "select ");
+ if (!plproxy_query_add_ident(cur_sql, $1))
+ yyerror("invalid argument reference: %s", $1);
+ }
+ ;
+
hash_func: FNCALL { hash_sql = plproxy_query_start(xfunc, false);
cur_sql = hash_sql;
plproxy_query_add_const(cur_sql, "select * from ");