Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions contrib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ include $(top_builddir)/src/Makefile.global
# adminpack is disabled since the functionality has been imported into
# GPDB.

# FIXME: installcheck for extension pageinspect, pg_visibility, postgres_fdw,
# seg, tsm_system_rows, tsm_system_time, xml2 is failed, which is also failed
# in gpdb. We'll fix it if we need these plugins to work properly.

SUBDIRS = \
amcheck \
auth_delay \
Expand Down
83 changes: 2 additions & 81 deletions contrib/adminpack/expected/adminpack.out
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,19 @@ SELECT pg_read_file('test_file1');

-- disallowed file paths for non-superusers and users who are
-- not members of pg_write_server_files
<<<<<<< HEAD
CREATE ROLE regress_user1;
NOTICE: resource queue required -- using default resource queue "pg_default"
GRANT pg_read_all_settings TO regress_user1;
GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_user1;
SET ROLE regress_user1;
SELECT pg_file_write('../test_file0', 'test0', false);
ERROR: only superuser may access generic file functions
=======
CREATE ROLE regress_adminpack_user1;
NOTICE: resource queue required -- using default resource queue "pg_default"
GRANT pg_read_all_settings TO regress_adminpack_user1;
GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_adminpack_user1;
SET ROLE regress_adminpack_user1;
SELECT pg_file_write('../test_file0', 'test0', false);
ERROR: path must be in or below the data directory
>>>>>>> REL_16_9
SELECT pg_file_write('/tmp/test_file0', 'test0', false);
ERROR: only superuser may access generic file functions
SELECT pg_file_write(current_setting('data_directory') || '/test_file4', 'test4', false);
ERROR: only superuser may access generic file functions
SELECT pg_file_write(current_setting('data_directory') || '/../test_file4', 'test4', false);
<<<<<<< HEAD
ERROR: only superuser may access generic file functions
=======
ERROR: absolute path not allowed
>>>>>>> REL_16_9
RESET ROLE;
REVOKE EXECUTE ON FUNCTION pg_file_write(text,text,bool) FROM regress_adminpack_user1;
REVOKE pg_read_all_settings FROM regress_adminpack_user1;
Expand Down Expand Up @@ -163,14 +150,9 @@ SELECT pg_file_unlink('test_file4');
(1 row)

-- superuser checks
<<<<<<< HEAD
CREATE USER regress_user1;
NOTICE: resource queue required -- using default resource queue "pg_default"
SET ROLE regress_user1;
=======
CREATE USER regress_adminpack_user1;
NOTICE: resource queue required -- using default resource queue "pg_default"
SET ROLE regress_adminpack_user1;
>>>>>>> REL_16_9
SELECT pg_file_write('test_file0', 'test0', false);
ERROR: permission denied for function pg_file_write
SELECT pg_file_sync('test_file0');
Expand All @@ -183,67 +165,6 @@ ERROR: permission denied for function pg_file_unlink
SELECT pg_logdir_ls();
ERROR: permission denied for function pg_logdir_ls
RESET ROLE;
<<<<<<< HEAD
DROP USER regress_user1;
-- allowed file paths for superuser test
CREATE ROLE regress_superuser1 SUPERUSER;
GRANT pg_read_all_settings TO regress_superuser1;
GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_superuser1;
SET ROLE regress_superuser1;
SELECT pg_file_write('../supper_test_file0', 'test0', false);
pg_file_write
---------------
5
(1 row)

SELECT pg_file_write('/tmp/supper_test_file0', 'test0', false);
pg_file_write
---------------
5
(1 row)

SELECT pg_file_write(current_setting('data_directory') || '/supper_test_file4', 'test4', false);
pg_file_write
---------------
5
(1 row)

SELECT pg_file_write(current_setting('data_directory') || '/../supper_test_file4', 'test4', false);
pg_file_write
---------------
5
(1 row)

SELECT pg_file_unlink('../supper_test_file0');
pg_file_unlink
----------------
t
(1 row)

SELECT pg_file_unlink('/tmp/supper_test_file0');
pg_file_unlink
----------------
t
(1 row)

SELECT pg_file_unlink(current_setting('data_directory') || '/supper_test_file4');
pg_file_unlink
----------------
t
(1 row)

SELECT pg_file_unlink(current_setting('data_directory') || '/../supper_test_file4');
pg_file_unlink
----------------
t
(1 row)

RESET ROLE;
REVOKE EXECUTE ON FUNCTION pg_file_write(text,text,bool) FROM regress_superuser1;
REVOKE pg_read_all_settings FROM regress_superuser1;
DROP ROLE regress_superuser1;
=======
DROP USER regress_adminpack_user1;
>>>>>>> REL_16_9
-- no further tests for pg_logdir_ls() because it depends on the
-- server's logging setup
1 change: 1 addition & 0 deletions contrib/amcheck/expected/check_btree.out
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ GRANT EXECUTE ON FUNCTION bt_index_check(regclass) TO regress_bttest_role;
GRANT EXECUTE ON FUNCTION bt_index_parent_check(regclass) TO regress_bttest_role;
GRANT EXECUTE ON FUNCTION bt_index_check(regclass, boolean) TO regress_bttest_role;
GRANT EXECUTE ON FUNCTION bt_index_parent_check(regclass, boolean) TO regress_bttest_role;
GRANT CREATE ON SCHEMA public TO regress_bttest_role;
SET ROLE regress_bttest_role;
SELECT bt_index_check('bttest_a_idx');
bt_index_check
Expand Down
1 change: 1 addition & 0 deletions contrib/amcheck/sql/check_btree.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ GRANT EXECUTE ON FUNCTION bt_index_check(regclass) TO regress_bttest_role;
GRANT EXECUTE ON FUNCTION bt_index_parent_check(regclass) TO regress_bttest_role;
GRANT EXECUTE ON FUNCTION bt_index_check(regclass, boolean) TO regress_bttest_role;
GRANT EXECUTE ON FUNCTION bt_index_parent_check(regclass, boolean) TO regress_bttest_role;
GRANT CREATE ON SCHEMA public TO regress_bttest_role;
SET ROLE regress_bttest_role;
SELECT bt_index_check('bttest_a_idx');
SELECT bt_index_parent_check('bttest_a_idx');
Expand Down
4 changes: 0 additions & 4 deletions contrib/amcheck/t/001_verify_heapam.pl
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

<<<<<<< HEAD
use Test::More tests => 80;
=======
use Test::More;
>>>>>>> REL_16_9

my ($node, $result);

Expand Down
19 changes: 0 additions & 19 deletions contrib/amcheck/t/002_cic.pl
Original file line number Diff line number Diff line change
@@ -1,43 +1,24 @@

<<<<<<< HEAD
# Copyright (c) 2021, PostgreSQL Global Development Group
=======
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
>>>>>>> REL_16_9

# Test CREATE INDEX CONCURRENTLY with concurrent modifications
use strict;
use warnings;

<<<<<<< HEAD
use Config;
use PostgresNode;
use TestLib;

use Test::More tests => 3;
=======
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

use Test::More;
>>>>>>> REL_16_9

my ($node, $result);

#
# Test set-up
#
<<<<<<< HEAD
$node = get_new_node('CIC_test');
$node->init;
$node->append_conf('postgresql.conf',
'lock_timeout = ' . (1000 * $TestLib::timeout_default));
=======
$node = PostgreSQL::Test::Cluster->new('CIC_test');
$node->init;
$node->append_conf('postgresql.conf',
'lock_timeout = ' . (1000 * $PostgreSQL::Test::Utils::timeout_default));
>>>>>>> REL_16_9
$node->start;
$node->safe_psql('postgres', q(CREATE EXTENSION amcheck));
$node->safe_psql('postgres', q(CREATE TABLE tbl(i int)));
Expand Down
102 changes: 0 additions & 102 deletions contrib/amcheck/t/003_cic_2pc.pl
Original file line number Diff line number Diff line change
@@ -1,51 +1,28 @@

<<<<<<< HEAD
# Copyright (c) 2021, PostgreSQL Global Development Group
=======
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
>>>>>>> REL_16_9

# Test CREATE INDEX CONCURRENTLY with concurrent prepared-xact modifications
use strict;
use warnings;

<<<<<<< HEAD
use Config;
use PostgresNode;
use TestLib;

use Test::More tests => 5;

Test::More->builder->todo_start('filesystem bug')
if TestLib::has_wal_read_bug;
=======
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;

use Test::More;

Test::More->builder->todo_start('filesystem bug')
if PostgreSQL::Test::Utils::has_wal_read_bug;
>>>>>>> REL_16_9

my ($node, $result);

#
# Test set-up
#
<<<<<<< HEAD
$node = get_new_node('CIC_2PC_test');
$node->init;
$node->append_conf('postgresql.conf', 'max_prepared_transactions = 10');
$node->append_conf('postgresql.conf',
'lock_timeout = ' . (1000 * $TestLib::timeout_default));
=======
$node = PostgreSQL::Test::Cluster->new('CIC_2PC_test');
$node->init;
$node->append_conf('postgresql.conf', 'max_prepared_transactions = 10');
$node->append_conf('postgresql.conf',
'lock_timeout = ' . (1000 * $PostgreSQL::Test::Utils::timeout_default));
>>>>>>> REL_16_9
$node->start;
$node->safe_psql('postgres', q(CREATE EXTENSION amcheck));
$node->safe_psql('postgres', q(CREATE TABLE tbl(i int)));
Expand All @@ -59,65 +36,6 @@
# statements.
#

<<<<<<< HEAD
my $main_in = '';
my $main_out = '';
my $main_timer = IPC::Run::timeout($TestLib::timeout_default);

my $main_h =
$node->background_psql('postgres', \$main_in, \$main_out,
$main_timer, on_error_stop => 1);
$main_in .= q(
BEGIN;
INSERT INTO tbl VALUES(0);
\echo syncpoint1
);
pump $main_h until $main_out =~ /syncpoint1/ || $main_timer->is_expired;

my $cic_in = '';
my $cic_out = '';
my $cic_timer = IPC::Run::timeout($TestLib::timeout_default);
my $cic_h =
$node->background_psql('postgres', \$cic_in, \$cic_out,
$cic_timer, on_error_stop => 1);
$cic_in .= q(
\echo start
CREATE INDEX CONCURRENTLY idx ON tbl(i);
);
pump $cic_h until $cic_out =~ /start/ || $cic_timer->is_expired;

$main_in .= q(
PREPARE TRANSACTION 'a';
);

$main_in .= q(
BEGIN;
INSERT INTO tbl VALUES(0);
\echo syncpoint2
);
pump $main_h until $main_out =~ /syncpoint2/ || $main_timer->is_expired;

$node->safe_psql('postgres', q(COMMIT PREPARED 'a';));

$main_in .= q(
PREPARE TRANSACTION 'b';
BEGIN;
INSERT INTO tbl VALUES(0);
\echo syncpoint3
);
pump $main_h until $main_out =~ /syncpoint3/ || $main_timer->is_expired;

$node->safe_psql('postgres', q(COMMIT PREPARED 'b';));

$main_in .= q(
PREPARE TRANSACTION 'c';
COMMIT PREPARED 'c';
);
$main_h->pump_nb;

$main_h->finish;
$cic_h->finish;
=======
my $main_h = $node->background_psql('postgres');

$main_h->query_safe(
Expand Down Expand Up @@ -164,7 +82,6 @@

$main_h->quit;
$cic_h->quit;
>>>>>>> REL_16_9

$result = $node->psql('postgres', q(SELECT bt_index_check('idx',true)));
is($result, '0', 'bt_index_check after overlapping 2PC');
Expand All @@ -185,24 +102,6 @@
));
$node->restart;

<<<<<<< HEAD
my $reindex_in = '';
my $reindex_out = '';
my $reindex_timer =
IPC::Run::timeout($TestLib::timeout_default);
my $reindex_h =
$node->background_psql('postgres', \$reindex_in, \$reindex_out,
$reindex_timer, on_error_stop => 1);
$reindex_in .= q(
\echo start
DROP INDEX CONCURRENTLY idx;
CREATE INDEX CONCURRENTLY idx ON tbl(i);
);
pump $reindex_h until $reindex_out =~ /start/ || $reindex_timer->is_expired;

$node->safe_psql('postgres', "COMMIT PREPARED 'spans_restart'");
$reindex_h->finish;
=======
my $reindex_h = $node->background_psql('postgres');
$reindex_h->query_until(
qr/start/, q(
Expand All @@ -213,7 +112,6 @@

$node->safe_psql('postgres', "COMMIT PREPARED 'spans_restart'");
$reindex_h->quit;
>>>>>>> REL_16_9
$result = $node->psql('postgres', q(SELECT bt_index_check('idx',true)));
is($result, '0', 'bt_index_check after 2PC and restart');

Expand Down
3 changes: 0 additions & 3 deletions contrib/auto_explain/expected/auto_explain.out
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ Query Text: SELECT relname FROM pg_class WHERE relname='pg_class';
Index Only Scan using pg_class_relname_nsp_index on pg_class (cost=0.15..4.17 rows=1 width=64) (actual rows=1 loops=1)
Index Cond: (relname = 'pg_class'::name)
Heap Fetches: 1
Optimizer: Postgres-based planner
(slice0) Executor memory: 105K bytes.
Memory used: 128000kB
relname
Expand All @@ -58,7 +57,6 @@ Finalize Aggregate (cost=35148.64..35148.65 rows=1 width=8) (actual rows=1 loop
-> Materialize (cost=0.00..68.06 rows=1001 width=0) (actual rows=1001 loops=340)
-> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..53.05 rows=1001 width=0) (actual rows=1001 loops=1)
-> Seq Scan on t2 (cost=0.00..13.01 rows=334 width=0) (actual rows=340 loops=1)
Optimizer: Postgres-based planner
(slice0) Executor memory: 131K bytes.
(slice1) Executor memory: 152K bytes avg x 3 workers, 152K bytes max (seg0).
(slice2) Executor memory: 42K bytes avg x 3 workers, 42K bytes max (seg0).
Expand Down Expand Up @@ -100,7 +98,6 @@ Finalize Aggregate (cost=35148.64..35148.65 rows=1 width=8) (actual rows=1 loop
work_mem: 142kB Segments: 3 Max: 48kB (segment 0) Workfile: (0 spilling)
-> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..53.05 rows=1001 width=0) (actual rows=1001 loops=1)
-> Seq Scan on auto_explain_test.t2 (cost=0.00..13.01 rows=334 width=0) (actual rows=340 loops=1)
Optimizer: Postgres-based planner
Settings: enable_nestloop = 'on', optimizer = 'off'
(slice0) Executor memory: 131K bytes.
(slice1) Executor memory: 152K bytes avg x 3 workers, 152K bytes max (seg0).
Expand Down
Loading
Loading