Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcc50080

Browse files
committed
Rearrange core regression tests to reduce cross-script dependencies.
The idea behind this patch is to make it possible to run individualtest scripts without running the entire core test suite. Making allthe scripts completely independent would involve a massive rewrite,and would probably be worse for coverage of things like concurrent DDL.So this patch just does what seems practical with limited changes.The net effect is that any test script can be run after runninglimited earlier dependencies:* all scripts depend on test_setup* many scripts depend on create_index* other dependencies are few in number, and are documented in the parallel_schedule file.To accomplish this, I chose a small number of commonly-used tablesand moved their creation and filling into test_setup. Later scriptsare expected not to modify these tables' data contents, for fear ofaffecting other scripts' results. Also, our former habit of declaringall C functions in one place is now gone in favor of declaring themwhere they're used, if that's just one script, or in test_setup ifnecessary.There's more that could be done to remove some of the remaininginter-script dependencies, but significantly more-invasive changeswould be needed, and at least for now it doesn't seem worth it.Discussion:https://postgr.es/m/1114748.1640383217@sss.pgh.pa.us
1 parentba15f16 commitcc50080

File tree

105 files changed

+2392
-2765
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+2392
-2765
lines changed

‎src/test/regress/expected/aggregates.out

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
--
22
-- AGGREGATES
33
--
4+
-- directory paths are passed to us in environment variables
5+
\getenv abs_srcdir PG_ABS_SRCDIR
46
-- avoid bit-exact output here because operations may not be bit-exact.
57
SET extra_float_digits = 0;
8+
-- prepare some test data
9+
CREATE TABLE aggtest (
10+
a int2,
11+
bfloat4
12+
);
13+
\set filename :abs_srcdir '/data/agg.data'
14+
COPY aggtest FROM :'filename';
15+
ANALYZE aggtest;
616
SELECT avg(four) AS avg_1 FROM onek;
717
avg_1
818
--------------------

‎src/test/regress/expected/alter_generic.out

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
--
22
-- Test for ALTER some_object {RENAME TO, OWNER TO, SET SCHEMA}
33
--
4+
-- directory paths and dlsuffix are passed to us in environment variables
5+
\getenv libdir PG_LIBDIR
6+
\getenv dlsuffix PG_DLSUFFIX
7+
\set regresslib :libdir '/regress' :dlsuffix
8+
CREATE FUNCTION test_opclass_options_func(internal)
9+
RETURNS void
10+
AS :'regresslib', 'test_opclass_options_func'
11+
LANGUAGE C;
412
-- Clean up in case a prior regression run failed
513
SET client_min_messages TO 'warning';
614
DROP ROLE IF EXISTS regress_alter_generic_user1;

‎src/test/regress/expected/arrays.out

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
--
22
-- ARRAYS
33
--
4+
-- directory paths are passed to us in environment variables
5+
\getenv abs_srcdir PG_ABS_SRCDIR
46
CREATE TABLE arrtest (
57
a int2[],
68
b int4[][][],
@@ -10,6 +12,14 @@ CREATE TABLE arrtest (
1012
fchar(5)[],
1113
gvarchar(5)[]
1214
);
15+
CREATE TABLE array_op_test (
16+
seqnoint4,
17+
iint4[],
18+
ttext[]
19+
);
20+
\set filename :abs_srcdir '/data/array.data'
21+
COPY array_op_test FROM :'filename';
22+
ANALYZE array_op_test;
1323
--
1424
-- only the 'e' array is 0-based, the others are 1-based.
1525
--
@@ -307,6 +317,9 @@ INSERT INTO arrtest_s VALUES(NULL, NULL);
307317
UPDATE arrtest_s SET a[:] = '{11, 12, 13, 14, 15}'; -- fail, no good with null
308318
ERROR: array slice subscript must provide both boundaries
309319
DETAIL: When assigning to a slice of an empty array value, slice boundaries must be fully specified.
320+
-- we want to work with a point_tbl that includes a null
321+
CREATE TEMP TABLE point_tbl AS SELECT * FROM public.point_tbl;
322+
INSERT INTO POINT_TBL(f1) VALUES (NULL);
310323
-- check with fixed-length-array type, such as point
311324
SELECT f1[0:1] FROM POINT_TBL;
312325
ERROR: slices of fixed-length arrays not implemented

‎src/test/regress/expected/btree_index.out

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,49 @@
11
--
22
-- BTREE_INDEX
3+
--
4+
-- directory paths are passed to us in environment variables
5+
\getenv abs_srcdir PG_ABS_SRCDIR
6+
CREATE TABLE bt_i4_heap (
7+
seqno int4,
8+
random int4
9+
);
10+
CREATE TABLE bt_name_heap (
11+
seqno name,
12+
random int4
13+
);
14+
CREATE TABLE bt_txt_heap (
15+
seqno text,
16+
random int4
17+
);
18+
CREATE TABLE bt_f8_heap (
19+
seqno float8,
20+
random int4
21+
);
22+
\set filename :abs_srcdir '/data/desc.data'
23+
COPY bt_i4_heap FROM :'filename';
24+
\set filename :abs_srcdir '/data/hash.data'
25+
COPY bt_name_heap FROM :'filename';
26+
\set filename :abs_srcdir '/data/desc.data'
27+
COPY bt_txt_heap FROM :'filename';
28+
\set filename :abs_srcdir '/data/hash.data'
29+
COPY bt_f8_heap FROM :'filename';
30+
ANALYZE bt_i4_heap;
31+
ANALYZE bt_name_heap;
32+
ANALYZE bt_txt_heap;
33+
ANALYZE bt_f8_heap;
34+
--
35+
-- BTREE ascending/descending cases
36+
--
37+
-- we load int4/text from pure descending data (each key is a new
38+
-- low key) and name/f8 from pure ascending data (each key is a new
39+
-- high key). we had a bug where new low keys would sometimes be
40+
-- "lost".
41+
--
42+
CREATE INDEX bt_i4_index ON bt_i4_heap USING btree (seqno int4_ops);
43+
CREATE INDEX bt_name_index ON bt_name_heap USING btree (seqno name_ops);
44+
CREATE INDEX bt_txt_index ON bt_txt_heap USING btree (seqno text_ops);
45+
CREATE INDEX bt_f8_index ON bt_f8_heap USING btree (seqno float8_ops);
46+
--
347
-- test retrieval of min/max keys for each index
448
--
549
SELECT b.*

‎src/test/regress/expected/char.out

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ SELECT char 'c' = char 'c' AS true;
1111

1212
--
1313
-- Build a table for testing
14+
-- (This temporarily hides the table created in test_setup.sql)
1415
--
15-
CREATE TABLE CHAR_TBL(f1 char);
16+
CREATETEMPTABLE CHAR_TBL(f1 char);
1617
INSERT INTO CHAR_TBL (f1) VALUES ('a');
1718
INSERT INTO CHAR_TBL (f1) VALUES ('A');
1819
-- any of the following three input formats are acceptable
@@ -104,13 +105,11 @@ DROP TABLE CHAR_TBL;
104105
--
105106
-- Now test longer arrays of char
106107
--
107-
CREATE TABLE CHAR_TBL(f1 char(4));
108-
INSERT INTO CHAR_TBL (f1) VALUES ('a');
109-
INSERT INTO CHAR_TBL (f1) VALUES ('ab');
110-
INSERT INTO CHAR_TBL (f1) VALUES ('abcd');
108+
-- This char_tbl was already created and filled in test_setup.sql.
109+
-- Here we just try to insert bad values.
110+
--
111111
INSERT INTO CHAR_TBL (f1) VALUES ('abcde');
112112
ERROR: value too long for type character(4)
113-
INSERT INTO CHAR_TBL (f1) VALUES ('abcd ');
114113
SELECT * FROM CHAR_TBL;
115114
f1
116115
------

‎src/test/regress/expected/char_1.out

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ SELECT char 'c' = char 'c' AS true;
1111

1212
--
1313
-- Build a table for testing
14+
-- (This temporarily hides the table created in test_setup.sql)
1415
--
15-
CREATE TABLE CHAR_TBL(f1 char);
16+
CREATETEMPTABLE CHAR_TBL(f1 char);
1617
INSERT INTO CHAR_TBL (f1) VALUES ('a');
1718
INSERT INTO CHAR_TBL (f1) VALUES ('A');
1819
-- any of the following three input formats are acceptable
@@ -104,13 +105,11 @@ DROP TABLE CHAR_TBL;
104105
--
105106
-- Now test longer arrays of char
106107
--
107-
CREATE TABLE CHAR_TBL(f1 char(4));
108-
INSERT INTO CHAR_TBL (f1) VALUES ('a');
109-
INSERT INTO CHAR_TBL (f1) VALUES ('ab');
110-
INSERT INTO CHAR_TBL (f1) VALUES ('abcd');
108+
-- This char_tbl was already created and filled in test_setup.sql.
109+
-- Here we just try to insert bad values.
110+
--
111111
INSERT INTO CHAR_TBL (f1) VALUES ('abcde');
112112
ERROR: value too long for type character(4)
113-
INSERT INTO CHAR_TBL (f1) VALUES ('abcd ');
114113
SELECT * FROM CHAR_TBL;
115114
f1
116115
------

‎src/test/regress/expected/char_2.out

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ SELECT char 'c' = char 'c' AS true;
1111

1212
--
1313
-- Build a table for testing
14+
-- (This temporarily hides the table created in test_setup.sql)
1415
--
15-
CREATE TABLE CHAR_TBL(f1 char);
16+
CREATETEMPTABLE CHAR_TBL(f1 char);
1617
INSERT INTO CHAR_TBL (f1) VALUES ('a');
1718
INSERT INTO CHAR_TBL (f1) VALUES ('A');
1819
-- any of the following three input formats are acceptable
@@ -104,13 +105,11 @@ DROP TABLE CHAR_TBL;
104105
--
105106
-- Now test longer arrays of char
106107
--
107-
CREATE TABLE CHAR_TBL(f1 char(4));
108-
INSERT INTO CHAR_TBL (f1) VALUES ('a');
109-
INSERT INTO CHAR_TBL (f1) VALUES ('ab');
110-
INSERT INTO CHAR_TBL (f1) VALUES ('abcd');
108+
-- This char_tbl was already created and filled in test_setup.sql.
109+
-- Here we just try to insert bad values.
110+
--
111111
INSERT INTO CHAR_TBL (f1) VALUES ('abcde');
112112
ERROR: value too long for type character(4)
113-
INSERT INTO CHAR_TBL (f1) VALUES ('abcd ');
114113
SELECT * FROM CHAR_TBL;
115114
f1
116115
------

‎src/test/regress/expected/conversion.out

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
--
22
-- create user defined conversion
33
--
4+
-- directory paths and dlsuffix are passed to us in environment variables
5+
\getenv libdir PG_LIBDIR
6+
\getenv dlsuffix PG_DLSUFFIX
7+
\set regresslib :libdir '/regress' :dlsuffix
8+
CREATE FUNCTION test_enc_conversion(bytea, name, name, bool, validlen OUT int, result OUT bytea)
9+
AS :'regresslib', 'test_enc_conversion'
10+
LANGUAGE C STRICT;
411
CREATE USER regress_conversion_user WITH NOCREATEDB NOCREATEROLE;
512
SET SESSION AUTHORIZATION regress_conversion_user;
613
CREATE CONVERSION myconv FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;

‎src/test/regress/expected/copy.out

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -4,84 +4,6 @@
44
-- directory paths are passed to us in environment variables
55
\getenv abs_srcdir PG_ABS_SRCDIR
66
\getenv abs_builddir PG_ABS_BUILDDIR
7-
-- CLASS POPULATION
8-
--(any resemblance to real life is purely coincidental)
9-
--
10-
\set filename :abs_srcdir '/data/agg.data'
11-
COPY aggtest FROM :'filename';
12-
\set filename :abs_srcdir '/data/onek.data'
13-
COPY onek FROM :'filename';
14-
\set filename :abs_builddir '/results/onek.data'
15-
COPY onek TO :'filename';
16-
DELETE FROM onek;
17-
COPY onek FROM :'filename';
18-
\set filename :abs_srcdir '/data/tenk.data'
19-
COPY tenk1 FROM :'filename';
20-
\set filename :abs_srcdir '/data/rect.data'
21-
COPY slow_emp4000 FROM :'filename';
22-
\set filename :abs_srcdir '/data/person.data'
23-
COPY person FROM :'filename';
24-
\set filename :abs_srcdir '/data/emp.data'
25-
COPY emp FROM :'filename';
26-
\set filename :abs_srcdir '/data/student.data'
27-
COPY student FROM :'filename';
28-
\set filename :abs_srcdir '/data/stud_emp.data'
29-
COPY stud_emp FROM :'filename';
30-
\set filename :abs_srcdir '/data/streets.data'
31-
COPY road FROM :'filename';
32-
\set filename :abs_srcdir '/data/real_city.data'
33-
COPY real_city FROM :'filename';
34-
\set filename :abs_srcdir '/data/hash.data'
35-
COPY hash_i4_heap FROM :'filename';
36-
COPY hash_name_heap FROM :'filename';
37-
COPY hash_txt_heap FROM :'filename';
38-
COPY hash_f8_heap FROM :'filename';
39-
\set filename :abs_srcdir '/data/tsearch.data'
40-
COPY test_tsvector FROM :'filename';
41-
\set filename :abs_srcdir '/data/jsonb.data'
42-
COPY testjsonb FROM :'filename';
43-
-- the data in this file has a lot of duplicates in the index key
44-
-- fields, leading to long bucket chains and lots of table expansion.
45-
-- this is therefore a stress test of the bucket overflow code (unlike
46-
-- the data in hash.data, which has unique index keys).
47-
--
48-
-- \set filename :abs_srcdir '/data/hashovfl.data'
49-
-- COPY hash_ovfl_heap FROM :'filename';
50-
\set filename :abs_srcdir '/data/desc.data'
51-
COPY bt_i4_heap FROM :'filename';
52-
\set filename :abs_srcdir '/data/hash.data'
53-
COPY bt_name_heap FROM :'filename';
54-
\set filename :abs_srcdir '/data/desc.data'
55-
COPY bt_txt_heap FROM :'filename';
56-
\set filename :abs_srcdir '/data/hash.data'
57-
COPY bt_f8_heap FROM :'filename';
58-
\set filename :abs_srcdir '/data/array.data'
59-
COPY array_op_test FROM :'filename';
60-
\set filename :abs_srcdir '/data/array.data'
61-
COPY array_index_op_test FROM :'filename';
62-
-- analyze all the data we just loaded, to ensure plan consistency
63-
-- in later tests
64-
ANALYZE aggtest;
65-
ANALYZE onek;
66-
ANALYZE tenk1;
67-
ANALYZE slow_emp4000;
68-
ANALYZE person;
69-
ANALYZE emp;
70-
ANALYZE student;
71-
ANALYZE stud_emp;
72-
ANALYZE road;
73-
ANALYZE real_city;
74-
ANALYZE hash_i4_heap;
75-
ANALYZE hash_name_heap;
76-
ANALYZE hash_txt_heap;
77-
ANALYZE hash_f8_heap;
78-
ANALYZE test_tsvector;
79-
ANALYZE bt_i4_heap;
80-
ANALYZE bt_name_heap;
81-
ANALYZE bt_txt_heap;
82-
ANALYZE bt_f8_heap;
83-
ANALYZE array_op_test;
84-
ANALYZE array_index_op_test;
857
--- test copying in CSV mode with various styles
868
--- of embedded line ending characters
879
create temp table copytest (

‎src/test/regress/expected/create_function_0.out

Lines changed: 9 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,20 @@
11
--
22
-- CREATE_FUNCTION_0
33
--
4+
-- This script used to create C functions for other scripts to use.
5+
-- But to get rid of the ordering dependencies that caused, such
6+
-- functions are now made either in test_setup.sql or in the specific
7+
-- test script that needs them. All that remains here is error cases.
48
-- directory path and dlsuffix are passed to us in environment variables
59
\getenv libdir PG_LIBDIR
610
\getenv dlsuffix PG_DLSUFFIX
7-
\set autoinclib :libdir '/autoinc' :dlsuffix
8-
\set refintlib :libdir '/refint' :dlsuffix
911
\set regresslib :libdir '/regress' :dlsuffix
10-
-- Create a bunch of C functions that will be used by later tests:
11-
CREATE FUNCTION check_primary_key ()
12-
RETURNS trigger
13-
AS :'refintlib'
14-
LANGUAGE C;
15-
CREATE FUNCTION check_foreign_key ()
16-
RETURNS trigger
17-
AS :'refintlib'
18-
LANGUAGE C;
19-
CREATE FUNCTION autoinc ()
20-
RETURNS trigger
21-
AS :'autoinclib'
22-
LANGUAGE C;
23-
CREATE FUNCTION trigger_return_old ()
24-
RETURNS trigger
25-
AS :'regresslib'
26-
LANGUAGE C;
27-
CREATE FUNCTION ttdummy ()
28-
RETURNS trigger
29-
AS :'regresslib'
30-
LANGUAGE C;
31-
CREATE FUNCTION set_ttdummy (int4)
32-
RETURNS int4
33-
AS :'regresslib'
34-
LANGUAGE C STRICT;
35-
CREATE FUNCTION make_tuple_indirect (record)
36-
RETURNS record
37-
AS :'regresslib'
38-
LANGUAGE C STRICT;
39-
CREATE FUNCTION test_atomic_ops()
40-
RETURNS bool
41-
AS :'regresslib'
42-
LANGUAGE C;
43-
CREATE FUNCTION test_fdw_handler()
44-
RETURNS fdw_handler
45-
AS :'regresslib', 'test_fdw_handler'
46-
LANGUAGE C;
47-
CREATE FUNCTION test_support_func(internal)
48-
RETURNS internal
49-
AS :'regresslib', 'test_support_func'
50-
LANGUAGE C STRICT;
51-
CREATE FUNCTION test_opclass_options_func(internal)
52-
RETURNS void
53-
AS :'regresslib', 'test_opclass_options_func'
54-
LANGUAGE C;
55-
CREATE FUNCTION test_enc_conversion(bytea, name, name, bool, validlen OUT int, result OUT bytea)
56-
AS :'regresslib', 'test_enc_conversion'
57-
LANGUAGE C STRICT;
58-
CREATE FUNCTION binary_coercible(oid, oid)
59-
RETURNS bool
60-
AS :'regresslib', 'binary_coercible'
61-
LANGUAGE C STRICT STABLE PARALLEL SAFE;
12+
--
13+
-- Check LOAD command. (The alternative of implicitly loading the library
14+
-- is checked in many other test scripts.)
15+
--
16+
LOAD :'regresslib';
6217
-- Things that shouldn't work:
63-
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
64-
AS 'SELECT ''not an integer'';';
65-
ERROR: return type mismatch in function declared to return integer
66-
DETAIL: Actual return type is text.
67-
CONTEXT: SQL function "test1"
68-
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
69-
AS 'not even SQL';
70-
ERROR: syntax error at or near "not"
71-
LINE 2: AS 'not even SQL';
72-
^
73-
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
74-
AS 'SELECT 1, 2, 3;';
75-
ERROR: return type mismatch in function declared to return integer
76-
DETAIL: Final statement must return exactly one column.
77-
CONTEXT: SQL function "test1"
78-
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
79-
AS 'SELECT $2;';
80-
ERROR: there is no parameter $2
81-
LINE 2: AS 'SELECT $2;';
82-
^
83-
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
84-
AS 'a', 'b';
85-
ERROR: only one AS item needed for language "sql"
8618
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
8719
AS 'nosuchfile';
8820
ERROR: could not access file "nosuchfile": No such file or directory

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp