diff options
author | Michael P | 2011-05-25 04:56:14 +0000 |
---|---|---|
committer | Michael P | 2011-05-26 00:56:39 +0000 |
commit | ac040624b275cca2c3b9c62c88be2bc88887f885 (patch) | |
tree | 5602cc8db3412ef57fa2f9d757c386e580d7172e | |
parent | eb593761cb84d35e63ee4af4adb804735e083ffa (diff) |
Support for DISCARD
This solves also bug 3307003 where it was impossible to
launch successive regression tests.
Regression test guc is updated with correct output.
-rw-r--r-- | src/backend/tcop/utility.c | 13 | ||||
-rw-r--r-- | src/test/regress/expected/guc_1.out | 85 |
2 files changed, 53 insertions, 45 deletions
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index 735c07aacc..9e2e9d44bf 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -1478,6 +1478,19 @@ standard_ProcessUtility(Node *parsetree, /* should we allow DISCARD PLANS? */ CheckRestrictedOperation("DISCARD"); DiscardCommand((DiscardStmt *) parsetree, isTopLevel); +#ifdef PGXC + /* Let the pooler manage the statement */ + if (IS_PGXC_COORDINATOR && !IsConnFromCoord()) + { + /* + * If command is local and we are not in a transaction block do NOT + * send this query to backend nodes + */ + if (!IsTransactionBlock()) + if (PoolManagerSetCommand(false, queryString) < 0) + elog(ERROR, "Postgres-XC: ERROR DISCARD query"); + } +#endif break; case T_CreateTrigStmt: diff --git a/src/test/regress/expected/guc_1.out b/src/test/regress/expected/guc_1.out index 83b5b6598b..d71a66c817 100644 --- a/src/test/regress/expected/guc_1.out +++ b/src/test/regress/expected/guc_1.out @@ -513,7 +513,6 @@ SELECT current_user = 'temp_reset_user'; (1 row) DROP ROLE temp_reset_user; -ERROR: permission denied to drop role -- -- Tests for function-local GUC settings -- @@ -521,35 +520,32 @@ set work_mem = '3MB'; create function report_guc(text) returns text as $$ select current_setting($1) $$ language sql set work_mem = '1MB'; -ERROR: stable and volatile not yet supported, function volatility has to be immutable select report_guc('work_mem'), current_setting('work_mem'); -ERROR: function report_guc(unknown) does not exist -LINE 1: select report_guc('work_mem'), current_setting('work_mem'); - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. + report_guc | current_setting +------------+----------------- + 1MB | 3MB +(1 row) + -- this should draw only a warning alter function report_guc(text) set search_path = no_such_schema; -ERROR: function report_guc(text) does not exist +NOTICE: schema "no_such_schema" does not exist -- with error occurring here select report_guc('work_mem'), current_setting('work_mem'); -ERROR: function report_guc(unknown) does not exist -LINE 1: select report_guc('work_mem'), current_setting('work_mem'); - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. +ERROR: schema "no_such_schema" does not exist alter function report_guc(text) reset search_path set work_mem = '2MB'; -ERROR: function report_guc(text) does not exist select report_guc('work_mem'), current_setting('work_mem'); -ERROR: function report_guc(unknown) does not exist -LINE 1: select report_guc('work_mem'), current_setting('work_mem'); - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. + report_guc | current_setting +------------+----------------- + 2MB | 3MB +(1 row) + alter function report_guc(text) reset all; -ERROR: function report_guc(text) does not exist select report_guc('work_mem'), current_setting('work_mem'); -ERROR: function report_guc(unknown) does not exist -LINE 1: select report_guc('work_mem'), current_setting('work_mem'); - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. + report_guc | current_setting +------------+----------------- + 3MB | 3MB +(1 row) + -- SET LOCAL is restricted by a function SET option create or replace function myfunc(int) returns text as $$ begin @@ -558,19 +554,19 @@ begin end $$ language plpgsql set work_mem = '1MB'; -ERROR: stable and volatile not yet supported, function volatility has to be immutable select myfunc(0), current_setting('work_mem'); -ERROR: function myfunc(integer) does not exist -LINE 1: select myfunc(0), current_setting('work_mem'); - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. + myfunc | current_setting +--------+----------------- + 2MB | 3MB +(1 row) + alter function myfunc(int) reset all; -ERROR: function myfunc(integer) does not exist select myfunc(0), current_setting('work_mem'); -ERROR: function myfunc(integer) does not exist -LINE 1: select myfunc(0), current_setting('work_mem'); - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. + myfunc | current_setting +--------+----------------- + 2MB | 2MB +(1 row) + set work_mem = '3MB'; -- but SET isn't create or replace function myfunc(int) returns text as $$ @@ -580,12 +576,12 @@ begin end $$ language plpgsql set work_mem = '1MB'; -ERROR: stable and volatile not yet supported, function volatility has to be immutable select myfunc(0), current_setting('work_mem'); -ERROR: function myfunc(integer) does not exist -LINE 1: select myfunc(0), current_setting('work_mem'); - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. + myfunc | current_setting +--------+----------------- + 2MB | 2MB +(1 row) + set work_mem = '3MB'; -- it should roll back on error, though create or replace function myfunc(int) returns text as $$ @@ -596,12 +592,10 @@ begin end $$ language plpgsql set work_mem = '1MB'; -ERROR: stable and volatile not yet supported, function volatility has to be immutable select myfunc(0); -ERROR: function myfunc(integer) does not exist -LINE 1: select myfunc(0); - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. +ERROR: division by zero +CONTEXT: SQL statement "SELECT 1/$1" +PL/pgSQL function "myfunc" line 3 at PERFORM select current_setting('work_mem'); current_setting ----------------- @@ -609,7 +603,8 @@ select current_setting('work_mem'); (1 row) select myfunc(1), current_setting('work_mem'); -ERROR: function myfunc(integer) does not exist -LINE 1: select myfunc(1), current_setting('work_mem'); - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. + myfunc | current_setting +--------+----------------- + 2MB | 2MB +(1 row) + |