Skip to content

Commit

Permalink
Disable .psqlrc in parallel_conn.sh
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
theory committed Nov 5, 2021
1 parent 07ba0c5 commit ec3c469
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions test/sql/partitions.sql
Expand Up @@ -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);
Expand Down Expand Up @@ -67,49 +67,49 @@ 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',
''
);

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',
''
);

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',
''
);

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',
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tools/parallel_conn.sh
Expand Up @@ -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"
Expand Down

0 comments on commit ec3c469

Please sign in to comment.