make RUN optional, defaulting to RUN ON 0;
authorMarko Kreen <markokr@gmail.com>
Wed, 14 May 2008 12:25:00 +0000 (12:25 +0000)
committerMarko Kreen <markokr@gmail.com>
Wed, 14 May 2008 12:25:00 +0000 (12:25 +0000)
expected/plproxy_test.out
sql/plproxy_test.sql
src/parser.y

index ed35e9e6f4a0b6e50886a389839a25695877b6f1..9cc596d3e047f50322d7da1e51d811720bf22cfb 100644 (file)
@@ -215,7 +215,7 @@ select * from test_types('types', NULL, NULL, NULL);
 create domain posint as int4 check (value > 0);
 create type struct as (id int4, data text);
 create function test_types2(username text, inout v_posint posint, inout v_struct struct, inout arr int8[])
-as $$ cluster 'testcluster'; run on 0; $$ language plproxy;
+as $$ cluster 'testcluster'; $$ language plproxy;
 \c test_part
 create domain posint as int4 check (value > 0);
 create type struct as (id int4, data text);
index 41dd0ece51f1ccc698611dc6b1981efcbf6000ba..43cd7d475de32023dc45de9ee1f7b3c0b3cd4f89 100644 (file)
@@ -127,7 +127,7 @@ create domain posint as int4 check (value > 0);
 create type struct as (id int4, data text);
 
 create function test_types2(username text, inout v_posint posint, inout v_struct struct, inout arr int8[])
-as $$ cluster 'testcluster'; run on 0; $$ language plproxy;
+as $$ cluster 'testcluster'; $$ language plproxy;
 
 \c test_part
 create domain posint as int4 check (value > 0);
index 9f19de248bab98f11af3b7cde281ad321d9b8ce9..9f21124b3eb330a1537ae48e98415b85f30da044 100644 (file)
@@ -151,6 +151,10 @@ void plproxy_run_parser(ProxyFunction *func, const char *body, int len)
        got_run = got_cluster = got_connect = 0;
        cur_sql = select_sql = cluster_sql = hash_sql = NULL;
 
+       /* By default expect RUN ON 0; */
+       xfunc->run_type = R_EXACT;
+       xfunc->exact_nr = 0;
+
        /* setup scanner */
        plproxy_yy_scan_bytes(body, len);
 
@@ -164,8 +168,6 @@ void plproxy_run_parser(ProxyFunction *func, const char *body, int len)
        } else {
                if (!got_cluster)
                        yyerror("CLUSTER statement missing");
-               if (!got_run)
-                       yyerror("RUN statement missing");
        }
 
        /* reinitialize scanner */