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

Commit537898b

Browse files
committed
Add more tests for CREATE TABLE AS with WITH NO DATA
The relation creation is done at executor startup, however the mainregression test suite is lacking scenarios where no data is insertedwhich is something that can happen when using EXECUTE or EXPLAIN withCREATE TABLE AS and WITH NO DATA.Some patches are worked on to reshape the way CTAS relations arecreated, so this makes sure that we do not miss some query patternsalready supported.Reported-by: Andreas KarlssonAuthor: Michael PaquierReviewed-by: Andreas KarlssonDiscussion:https://postgr.es/m/20190206091817.GB14980@paquier.xyz
1 parenteba7753 commit537898b

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ SELECT * FROM q5_prep_results;
145145
9961 | 2058 | 1 | 1 | 1 | 1 | 61 | 961 | 1961 | 4961 | 9961 | 122 | 123 | DTAAAA | EBDAAA | OOOOxx
146146
(16 rows)
147147

148+
CREATE TEMPORARY TABLE q5_prep_nodata AS EXECUTE q5(200, 'DTAAAA')
149+
WITH NO DATA;
150+
SELECT * FROM q5_prep_nodata;
151+
unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
152+
---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
153+
(0 rows)
154+
148155
-- unknown or unspecified parameter types: should succeed
149156
PREPARE q6 AS
150157
SELECT * FROM tenk1 WHERE unique1 = $1 AND stringu1 = $2;

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,15 @@ SELECT * FROM created_table;
112112
4567890123456789 | -4567890123456789
113113
(5 rows)
114114

115-
-- Try EXPLAIN ANALYZE SELECT INTO, but hide the output since it won't
116-
-- be stable.
115+
-- Try EXPLAIN ANALYZE SELECT INTO and EXPLAIN ANALYZE CREATE TABLE AS
116+
--WITH NO DATA, but hide the outputs since they won'tbe stable.
117117
DO $$
118118
BEGIN
119119
EXECUTE 'EXPLAIN ANALYZE SELECT * INTO TABLE easi FROM int8_tbl';
120+
EXECUTE 'EXPLAIN ANALYZE CREATE TABLE easi2 AS SELECT * FROM int8_tbl WITH NO DATA';
120121
END$$;
121122
DROP TABLE created_table;
122-
DROP TABLE easi;
123+
DROP TABLE easi, easi2;
123124
--
124125
-- Disallowed uses of SELECT ... INTO. All should fail
125126
--

‎src/test/regress/sql/prepare.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ PREPARE q5(int, text) AS
6161
ORDER BY unique1;
6262
CREATE TEMPORARY TABLE q5_prep_resultsAS EXECUTE q5(200,'DTAAAA');
6363
SELECT*FROM q5_prep_results;
64+
CREATE TEMPORARY TABLE q5_prep_nodataAS EXECUTE q5(200,'DTAAAA')
65+
WITH NO DATA;
66+
SELECT*FROM q5_prep_nodata;
6467

6568
-- unknown or unspecified parameter types: should succeed
6669
PREPARE q6AS

‎src/test/regress/sql/select_into.sql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,16 @@ SELECT make_table();
8585

8686
SELECT*FROM created_table;
8787

88-
-- Try EXPLAIN ANALYZE SELECT INTO, but hide the output since it won't
89-
-- be stable.
88+
-- Try EXPLAIN ANALYZE SELECT INTO and EXPLAIN ANALYZE CREATE TABLE AS
89+
--WITH NO DATA, but hide the outputs since they won'tbe stable.
9090
DO $$
9191
BEGIN
9292
EXECUTE'EXPLAIN ANALYZE SELECT * INTO TABLE easi FROM int8_tbl';
93+
EXECUTE'EXPLAIN ANALYZE CREATE TABLE easi2 AS SELECT * FROM int8_tbl WITH NO DATA';
9394
END$$;
9495

9596
DROPTABLE created_table;
96-
DROPTABLE easi;
97+
DROPTABLE easi, easi2;
9798

9899
--
99100
-- Disallowed uses of SELECT ... INTO. All should fail

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp