Skip to content

Commit

Permalink
[pg15] test: port regress for cc50080a828d
Browse files Browse the repository at this point in the history
Summary:
Port regress test changes as in upstream PG commit
cc50080a828dd4791b43539f5a0f976e535d147c titled

    Rearrange core regression tests to reduce cross-script dependencies.

Differences compared to the upstream commit:

- aggregates: YB master e554bda
  incorrectly modified the spacing in CREATE TABLE aggtest to be
  "better", but this deviates from upstream PG, so revert it back to
  match upstream PG
- alter_generic: none
- arrays: switch temp table to YB table
- btree_index: skip (test previously unported)
- char: skip (test previously unported)
- conversion: add new test
- copy: delete test since existing queries are all moved out
- create_function_0: YB modifies LOAD command but forgets semicolon.
  This is also a problem in master, but it doesn't have much affect
  there since the command still ends up getting run as it is the last
  command in the file.  After porting tihs PG commit's changes, the
  lack of semicolon does matter, so add it.  Then, expect this test to
  start passing.
- create_function_1: skip changes related to previously unported
  test_canonicalize_path
- create_function_2: none
- create_function_3: none
- create_index: skip lots of unported queries
- create_misc: delete test since existing queries are all moved out
- create_operator: none
- create_table: skip lots of unported queries
- create_type: none
- create_view: add new test; skip unported queries
- errors: translate YB modifications
- expressions: skip changes related to previously unported queries
- float8: switch temp table to YB table; merge DROP TABLE
- foreign_data: none
- geometry: skip (affected queries previously unported)
- hash_index: skip (affected queries previously unported)
- horology: skip (affected queries previously unported)
- indirect_toast: add new test
- insert: none
- int2: translate YB modifications into test_setup
- int4: translate YB modifications into test_setup
- int8: translate YB modifications into test_setup
- join: skip (affected queries previously unported)
- jsonb: none
- lock: add new test
- misc: add new test; translate YB modifications; switch temp table to
  YB table; skip unported queries
- misc_functions: skip unported queries
- point:
  - skip unported queries (newly added by PG)
  - YB master deviated from PG 11 by inserting null in point test rather
    than create_index test.  By porting the changes to this file, this
    discrepancy goes away here in the YB pg15 branch.  Do that and
    update expected output to not expect null rows in both yb_pg_point
    and yb_pg_geometry.  Don't bother fixing the discrepancy on master
    because the dependency situation is not pretty: point ->
    create_index -> arrays.
- rangetypes: none
- rules: update query like PG does, ignoring previous YB modifications,
  and remove lines from output like PG does
- sanity_check: skip (test previously unported)
- select: none
- select_distinct: none
- select_distinct_on: queries should have been affected, but
  79bba07 incorrectly ported the test
  in such a way that there is no change needed
- select_into: skip (test previously unported)
- test_setup: add new test; skip unported queries except some VACUUM
  ANALYZE; update output with WARNING/ERROR for VACUUM
- text: translate YB modifications into test_setup
- transactions: skip (test previously unported)
- triggers: none
- tsearch: none
- type_sanity: skip (test previously unported)
- varchar: switch temp table to YB table
- with: translate YB modifications

Update yb_dep_* tests, schedules, and README.  Add new yb_dep_float8_tbl
and yb_dep_part_test_int4_ops tests to fill in some gaps introduced by
this change.  Update expectations of some tests in pg15_tests/ to match
the better shape the regress tests are in.

Add pg15_tests/test_types_geo.sh because the point merge was nontrivial.

(Note: yb_pg_partition_prune could deduplicate copy-paste of
part_test_int4_ops, but this should be applied to master first.)

Test Plan:
Almalinux 8:

    #!/usr/bin/env bash
    set -eu
    ./yb_build.sh fastdebug --gcc11
    pg15_tests/run_all_tests.sh fastdebug --gcc11 --sj --sp --scb
    pg15_tests/run_test_n_times.sh test_types_geo.sh 10 fastdebug --gcc11 --sj --scb --sp

Jenkins: skip

Reviewers: aagrawal, tfoucher

Reviewed By: tfoucher

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D30960
  • Loading branch information
jaki committed Dec 13, 2023
1 parent 32705bb commit 946a8a9
Show file tree
Hide file tree
Showing 121 changed files with 1,426 additions and 1,616 deletions.
9 changes: 1 addition & 8 deletions pg15_tests/test_D29226.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,12 @@ pushd src/postgres/src/test/regress
diff <(for f in yb_*_schedule; do ./yb_lint_regress_schedule.sh "$f" || echo "$f"; done) - <<EOT
test: yb_pg_rolenames
yb_pg_auth_serial_schedule
test: yb_pg_create_function_0
yb_pg_foreign_data_schedule
test: yb_pg_create_function_3
test: yb_pg_identity
yb_pg_misc_independent_serial_schedule
test: yb_pg_create_function_1
test: yb_pg_create_type
test: yb_pg_create_table
test: yb_pg_create_function_2
yb_pg_misc_serial_schedule
test: yb_pg_create_function_1
yb_pg_types_udt_serial_schedule
test: yb_pg_create_function_0
yb_triggers_schedule
yb_pg_misc_serial_schedule
EOT
popd
2 changes: 1 addition & 1 deletion pg15_tests/test_D29490.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source "${BASH_SOURCE[0]%/*}"/common.sh
java_test TestPgRegressTabletSplit
java_test TestPgRegressPgMisc false
grep_in_java_test \
"failed tests: [yb_pg_create_function_2, yb_pg_create_operator, yb_pg_create_table, yb_pg_create_type, yb_pg_int4, yb_pg_int8, yb_pg_with]" \
"failed tests: [yb_pg_create_operator, yb_pg_create_table, yb_pg_create_type, yb_pg_with]" \
TestPgRegressPgMisc
java_test TestPgRegressTrigger false
grep_in_java_test \
Expand Down
16 changes: 16 additions & 0 deletions pg15_tests/test_types_geo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
source "${BASH_SOURCE[0]%/*}"/common.sh

# Modified slightly due to D29444.
java_test TestPgRegressTypesGeo false
# yb_pg_point should pass.
grep_in_java_test \
"failed tests: [yb_pg_geometry, yb_pg_line, yb_pg_polygon]" \
TestPgRegressTypesGeo
# yb_pg_geometry should only have a small failure.
diff <(diff build/latest/postgres_build/src/test/regress/{expected,results}/yb_pg_geometry.out || true) - <<EOT
132c132
< | (0,0) | [(0,0),(6,6)] | (-0,0)
---
> | (0,0) | [(0,0),(6,6)] | (0,0)
EOT
5 changes: 2 additions & 3 deletions src/postgres/src/test/regress/README
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ the bottom of docs/content/latest/contribute/core-database/run-unit-tests.md
for this naming convention.

Ported tests (those named yb_pg_foo) should be ordered the same way as
serial_schedule. Otherwise, tests may not have the right dependencies or
expected state. For example, in yb_arrays_schedule, yb_pg_int8 should come
before yb_pg_point because serial_schedule has int8 before point.
parallel_schedule. Otherwise, tests may not have the right dependencies or
expected state.
24 changes: 0 additions & 24 deletions src/postgres/src/test/regress/expected/yb_dep_aggtest.out

This file was deleted.

25 changes: 0 additions & 25 deletions src/postgres/src/test/regress/expected/yb_dep_array_op_test.out

This file was deleted.

19 changes: 19 additions & 0 deletions src/postgres/src/test/regress/expected/yb_dep_float8_tbl.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--
-- A collection of queries to build the float8_tbl table.
--
-- The queries are taken from the relevant dependency files. Since it is
-- faster to run this rather than each file itself (e.g. dependency chain
-- test_setup, create_index), prefer using this.
--
--
-- test_setup
--
CREATE TABLE FLOAT8_TBL(f1 float8);
INSERT INTO FLOAT8_TBL(f1) VALUES
('0.0'),
('-34.84'),
('-1004.30'),
('-1.2345678901234e+200'),
('-1.2345678901234e-200');
VACUUM FLOAT8_TBL;
WARNING: VACUUM will be ignored
20 changes: 10 additions & 10 deletions src/postgres/src/test/regress/expected/yb_dep_int4_tbl.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
--
-- The queries are taken from the relevant dependency files. Since it is
-- faster to run this rather than each file itself (e.g. dependency chain
-- create_function_1, create_type, create_table, copy, create_index), prefer
-- using this.
-- test_setup, create_index), prefer using this.
--
--
-- int4
-- test_setup
--
CREATE TABLE INT4_TBL(f1 int4);
INSERT INTO INT4_TBL(f1) VALUES (' 0 ');
INSERT INTO INT4_TBL(f1) VALUES ('123456 ');
INSERT INTO INT4_TBL(f1) VALUES (' -123456');
--
-- largest and smallest values
INSERT INTO INT4_TBL(f1) VALUES ('2147483647');
INSERT INTO INT4_TBL(f1) VALUES ('-2147483647');
INSERT INTO INT4_TBL(f1) VALUES
(' 0 '),
('123456 '),
(' -123456'),
('2147483647'), -- largest and smallest values
('-2147483647');
VACUUM INT4_TBL;
WARNING: VACUUM will be ignored
17 changes: 7 additions & 10 deletions src/postgres/src/test/regress/expected/yb_dep_onek.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
--
-- The queries are taken from the relevant dependency files. Since it is
-- faster to run this rather than each file itself (e.g. dependency chain
-- create_function_1, create_type, create_table, copy, create_index), prefer
-- using this.
-- test_setup, create_index), prefer using this.
--
--
-- create_table
-- test_setup
--
\getenv abs_srcdir PG_ABS_SRCDIR
--
CREATE TABLE onek (
unique1 int4,
Expand All @@ -27,15 +28,11 @@ CREATE TABLE onek (
stringu2 name,
string4 name
);
--
-- copy
--
\getenv abs_srcdir PG_ABS_SRCDIR
--
\set filename :abs_srcdir '/data/onek.data'
COPY onek FROM :'filename';
--
ANALYZE onek;
VACUUM ANALYZE onek;
WARNING: VACUUM will be ignored
ERROR: Transaction for catalog table write operation 'pg_statistic' not found
--
-- yb_pg_create_index
-- (With modification to make them all nonconcurrent for performance.)
Expand Down
12 changes: 5 additions & 7 deletions src/postgres/src/test/regress/expected/yb_dep_onek2.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
--
-- The queries are taken from the relevant dependency files. Since it is
-- faster to run this rather than each file itself (e.g. dependency chain
-- create_function_1, create_type, create_table, copy, create_index), prefer
-- using this.
-- test_setup, create_index), prefer using this.
--
-- DEPENDENCY: this file must be run after onek has been populated (by
-- yb_dep_onek).
--
--
-- create_misc
-- test_setup
--
CREATE TABLE onek2 AS SELECT * FROM onek;
VACUUM ANALYZE onek2;
WARNING: VACUUM will be ignored
ERROR: Transaction for catalog table write operation 'pg_statistic' not found
--
-- yb_pg_create_index
-- (With modification to make them all nonconcurrent for performance.)
Expand All @@ -26,7 +28,3 @@ NOTICE: index method "btree" was replaced with "lsm" in YugabyteDB
CREATE INDEX NONCONCURRENTLY onek2_stu1_prtl ON onek2 USING btree(stringu1 name_ops ASC)
where onek2.stringu1 >= 'J' and onek2.stringu1 < 'K';
NOTICE: index method "btree" was replaced with "lsm" in YugabyteDB
--
-- select
--
ANALYZE onek2;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--
-- A collection of queries to build the part_test_int4_ops opclass.
--
-- The queries are taken from the relevant dependency files. Since it is
-- faster to run this rather than each file itself (e.g. dependency chain
-- test_setup, create_index), prefer using this.
--
--
-- test_setup
--
create function part_hashint4_noop(value int4, seed int8)
returns int8 as $$
select value + seed;
$$ language sql strict immutable parallel safe;
create operator class part_test_int4_ops for type int4 using hash as
operator 1 =,
function 2 part_hashint4_noop(int4, int8);
17 changes: 7 additions & 10 deletions src/postgres/src/test/regress/expected/yb_dep_person.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@
--
-- The queries are taken from the relevant dependency files. Since it is
-- faster to run this rather than each file itself (e.g. dependency chain
-- create_function_1, create_type, create_table, copy, create_index), prefer
-- using this.
-- test_setup, create_index), prefer using this.
--
--
-- create_table
-- test_setup
--
\getenv abs_srcdir PG_ABS_SRCDIR
--
CREATE TABLE person (
name text,
age int4,
location point
);
--
-- copy
--
\getenv abs_srcdir PG_ABS_SRCDIR
--
\set filename :abs_srcdir '/data/person.data'
COPY person FROM :'filename';
--
ANALYZE person;
VACUUM ANALYZE person;
WARNING: VACUUM will be ignored
ERROR: Transaction for catalog table write operation 'pg_statistic' not found
17 changes: 7 additions & 10 deletions src/postgres/src/test/regress/expected/yb_dep_tenk1.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
--
-- The queries are taken from the relevant dependency files. Since it is
-- faster to run this rather than each file itself (e.g. dependency chain
-- create_function_1, create_type, create_table, copy, create_index), prefer
-- using this.
-- test_setup, create_index), prefer using this.
--
--
-- yb_pg_create_table
-- test_setup
--
\getenv abs_srcdir PG_ABS_SRCDIR
--
CREATE TABLE tenk1 (
unique1 int4,
Expand All @@ -27,15 +28,11 @@ CREATE TABLE tenk1 (
stringu2 name,
string4 name
);
--
-- copy
--
\getenv abs_srcdir PG_ABS_SRCDIR
--
\set filename :abs_srcdir '/data/tenk.data'
COPY tenk1 FROM :'filename';
--
ANALYZE tenk1;
VACUUM ANALYZE tenk1;
WARNING: VACUUM will be ignored
ERROR: Transaction for catalog table write operation 'pg_statistic' not found
--
-- yb_pg_create_index
-- (With modification to make them all nonconcurrent for performance.)
Expand Down
33 changes: 7 additions & 26 deletions src/postgres/src/test/regress/expected/yb_dep_tenk2.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,18 @@
--
-- The queries are taken from the relevant dependency files. Since it is
-- faster to run this rather than each file itself (e.g. dependency chain
-- create_function_1, create_type, create_table, copy, create_index), prefer
-- using this.
-- test_setup, create_index), prefer using this.
--
-- DEPENDENCY: this file must be run after tenk1 has been populated (by
-- yb_dep_tenk1).
--
--
-- create_table
--
CREATE TABLE tenk2 (
unique1 int4,
unique2 int4,
two int4,
four int4,
ten int4,
twenty int4,
hundred int4,
thousand int4,
twothousand int4,
fivethous int4,
tenthous int4,
odd int4,
even int4,
stringu1 name,
stringu2 name,
string4 name
);
--
-- create_misc
--
INSERT INTO tenk2 SELECT * FROM tenk1;
-- test_setup
--
CREATE TABLE tenk2 AS SELECT * FROM tenk1;
VACUUM ANALYZE tenk2;
WARNING: VACUUM will be ignored
ERROR: Transaction for catalog table write operation 'pg_statistic' not found
--
-- yb_pg_create_index
-- (With modification to make them all nonconcurrent for performance.)
Expand Down
24 changes: 0 additions & 24 deletions src/postgres/src/test/regress/expected/yb_dep_test_tsvector.out

This file was deleted.

21 changes: 0 additions & 21 deletions src/postgres/src/test/regress/expected/yb_dep_testjsonb.out

This file was deleted.

Loading

0 comments on commit 946a8a9

Please sign in to comment.