From 472808e36f9ed36bd70d5a93dbb2b1a300701101 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Fri, 5 Nov 2021 16:51:11 -0400 Subject: [PATCH] Disable .psqlrc in parallel_conn.sh I have the timer enabled in my ~/.psqlrc, which messed with the collection of output in `parallel_conn.sh`, so tests never ran in parallel. So use -X to disable `.psqlrc`, and add some other options to eliminate other stuff that might appear in the output. Restores parallel testing on 9.6 and later on my box, which means the partition test is properly skipped on 9.6. Mostly fixes issue #279, though we should also be sure that serialized tests always pass, too. While at it, change the table names in the partitions test to eliminate conflicts with the inheritance tests. --- test/sql/partitions.sql | 30 +++++++++++++++--------------- tools/parallel_conn.sh | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test/sql/partitions.sql b/test/sql/partitions.sql index 54c704bed..09e564506 100644 --- a/test/sql/partitions.sql +++ b/test/sql/partitions.sql @@ -8,8 +8,8 @@ SELECT plan(102); SET client_min_messages = warning; -- Create inherited tables (not partitions). -CREATE TABLE public.parent(id INT PRIMARY KEY); -CREATE TABLE public.child(id INT PRIMARY KEY) INHERITS (public.parent); +CREATE TABLE public.base(id INT PRIMARY KEY); +CREATE TABLE public.sub(id INT PRIMARY KEY) INHERITS (public.base); -- Create a partitioned table with two partitions. CREATE TABLE public.parted(id INT NOT NULL) PARTITION BY RANGE (id); @@ -67,7 +67,7 @@ SELECT * FROM check_test( -- is_partition_of() should fail for inherited but not partitioned tables. SELECT * FROM check_test( - is_partition_of( 'public', 'child', 'public', 'parent', 'whatevs' ), + is_partition_of( 'public', 'sub', 'public', 'base', 'whatevs' ), false, 'is_partition_of( csch, non-part ctab, psch, non-part ptab, desc )', 'whatevs', @@ -75,16 +75,16 @@ SELECT * FROM check_test( ); SELECT * FROM check_test( - is_partition_of( 'child', 'parent', 'whatevs' ), + is_partition_of( 'sub', 'base', 'whatevs' ), false, 'is_partition_of( non-part ctab, non-part ptab, desc )', 'whatevs', '' ); --- is_partition_of() should fail for parted table and non-part child. +-- is_partition_of() should fail for parted table and non-part sub. SELECT * FROM check_test( - is_partition_of( 'public', 'child', 'public', 'parted', 'whatevs' ), + is_partition_of( 'public', 'sub', 'public', 'parted', 'whatevs' ), false, 'is_partition_of( csch, non-part ctab, psch, ptab, desc )', 'whatevs', @@ -92,16 +92,16 @@ SELECT * FROM check_test( ); SELECT * FROM check_test( - is_partition_of( 'child', 'parted', 'whatevs' ), + is_partition_of( 'sub', 'parted', 'whatevs' ), false, 'is_partition_of( non-part ctab, ptab, desc )', 'whatevs', '' ); --- is_partition_of() should fail for partition child but wrong parent. +-- is_partition_of() should fail for partition sub but wrong base. SELECT * FROM check_test( - is_partition_of( 'public', 'part1', 'public', 'parent', 'whatevs' ), + is_partition_of( 'public', 'part1', 'public', 'base', 'whatevs' ), false, 'is_partition_of( csch, ctab, psch, non-part ptab, desc )', 'whatevs', @@ -109,7 +109,7 @@ SELECT * FROM check_test( ); SELECT * FROM check_test( - is_partition_of( 'part1', 'parent', 'whatevs' ), + is_partition_of( 'part1', 'base', 'whatevs' ), false, 'is_partition_of( ctab, non-part ptab, desc )', 'whatevs', @@ -152,7 +152,7 @@ SELECT * FROM check_test( '' ); --- Should find public partition for hidden parent. +-- Should find public partition for hidden base. SELECT * FROM check_test( is_partition_of( 'public', 'not_hidden_part3', 'hide', 'hidden_parted', 'whatevs' ), true, @@ -307,21 +307,21 @@ SELECT * FROM check_test( -- Should not work for unpartitioned but inherited table SELECT * FROM check_test( - partitions_are( 'public', 'parent', '{child}', 'hi' ), + partitions_are( 'public', 'base', '{sub}', 'hi' ), false, 'partitions_are( sch, non-parted tab, inherited tab, desc )', 'hi', ' Missing partitions: - child' + sub' ); SELECT * FROM check_test( - partitions_are( 'parent', '{child}'::name[], 'hi' ), + partitions_are( 'base', '{sub}'::name[], 'hi' ), false, 'partitions_are( non-parted tab, inherited tab, desc )', 'hi', ' Missing partitions: - child' + sub' ); -- Should not work for non-existent table. diff --git a/tools/parallel_conn.sh b/tools/parallel_conn.sh index 5cad67e8d..1923ec540 100755 --- a/tools/parallel_conn.sh +++ b/tools/parallel_conn.sh @@ -22,7 +22,7 @@ fi COMMAND="SELECT greatest(1, current_setting('max_connections')::int - current_setting('superuser_reserved_connections')::int - (SELECT count(*) FROM pg_stat_activity) - 2)" -if PARALLEL_CONN=`psql -d ${PGDATABASE:-postgres} -qtc "$COMMAND" 2> /dev/null`; then +if PARALLEL_CONN=`psql -d ${PGDATABASE:-postgres} -P pager=off -P tuples_only=true -qAXtc "$COMMAND" 2> /dev/null`; then if [ $PARALLEL_CONN -ge 1 ] 2>/dev/null; then # We know it's a number at this point [ $PARALLEL_CONN -eq 1 ] && error "NOTICE: unable to run tests in parallel; not enough connections"