Description: Fix failures of tests on recent postgres builds

In recent postgres builds you cannot set client_min_messages to
values higher then ERROR, if will silently set it to ERROR if so.

During some tests we would set it to fatal to hide random values
(eg. pid's of processes) from the test output. This patch will use
different tactics for hiding these values.
release-7.4
Nils Dijk 2018-11-13 16:10:36 +01:00 committed by Marco Slot
parent 5a7e4d8a57
commit 3abb5e5715
5 changed files with 32 additions and 2 deletions

View File

@ -9,3 +9,6 @@
# Regression test output
/regression.diffs
/regression.out
# Failure test side effets
/proxy.output

View File

@ -225,8 +225,12 @@ ERROR: parameter "citus.max_task_string_size" cannot be changed without restart
-- error message may vary between executions
-- hiding warning and error message
-- no output means the query has failed
SET client_min_messages to FATAL;
SET client_min_messages to ERROR;
SELECT raise_failed_execution('
SELECT u.* FROM wide_table u JOIN wide_table v ON (u.long_column_002 = v.long_column_003);
');
ERROR: Task failed to execute
CONTEXT: PL/pgSQL function raise_failed_execution(text) line 6 at RAISE
-- following will succeed since it fetches few columns
SELECT u.long_column_001, u.long_column_002, u.long_column_003 FROM wide_table u JOIN wide_table v ON (u.long_column_002 = v.long_column_003);
long_column_001 | long_column_002 | long_column_003

View File

@ -84,3 +84,13 @@ $desc_views$
(1 row)
-- Create a function to make sure that queries returning the same result
CREATE FUNCTION raise_failed_execution(query text) RETURNS void AS $$
BEGIN
EXECUTE query;
EXCEPTION WHEN OTHERS THEN
IF SQLERRM LIKE 'failed to execute task%' THEN
RAISE 'Task failed to execute';
END IF;
END;
$$LANGUAGE plpgsql;

View File

@ -220,9 +220,11 @@ SET citus.max_task_string_size TO 20000;
-- error message may vary between executions
-- hiding warning and error message
-- no output means the query has failed
SET client_min_messages to FATAL;
SET client_min_messages to ERROR;
SELECT raise_failed_execution('
SELECT u.* FROM wide_table u JOIN wide_table v ON (u.long_column_002 = v.long_column_003);
');
-- following will succeed since it fetches few columns
SELECT u.long_column_001, u.long_column_002, u.long_column_003 FROM wide_table u JOIN wide_table v ON (u.long_column_002 = v.long_column_003);

View File

@ -81,3 +81,14 @@ WHERE cc.constraint_schema = ccu.constraint_schema AND
ORDER BY cc.constraint_name ASC;
$desc_views$
);
-- Create a function to make sure that queries returning the same result
CREATE FUNCTION raise_failed_execution(query text) RETURNS void AS $$
BEGIN
EXECUTE query;
EXCEPTION WHEN OTHERS THEN
IF SQLERRM LIKE 'failed to execute task%' THEN
RAISE 'Task failed to execute';
END IF;
END;
$$LANGUAGE plpgsql;