summaryrefslogtreecommitdiff
path: root/src/test/regress/expected/create_view.out
diff options
context:
space:
mode:
authorTom Lane2022-02-15 17:57:44 +0000
committerTom Lane2022-02-15 17:57:44 +0000
commit2523928b285b06242e0c669fadfc76d73bafdd66 (patch)
treefb26df74cdc176c0d9f6bfe36e334679c5dbb9c5 /src/test/regress/expected/create_view.out
parent4d373e05286daff05d7fd0f6e4ab7ff4e5304d81 (diff)
Reject change of output-column collation in CREATE OR REPLACE VIEW.
checkViewTupleDesc() didn't get the memo that it should verify same attcollation along with same type/typmod. (A quick scan did not find other similar oversights.) Per bug #17404 from Pierre-AurĂ©lien Georges. On another day I might've back-patched this, but today I'm feeling paranoid about unnecessary behavioral changes in back branches. Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/test/regress/expected/create_view.out')
-rw-r--r--src/test/regress/expected/create_view.out34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/test/regress/expected/create_view.out b/src/test/regress/expected/create_view.out
index ca1833dc66d..ae7c04353cf 100644
--- a/src/test/regress/expected/create_view.out
+++ b/src/test/regress/expected/create_view.out
@@ -54,27 +54,27 @@ CREATE VIEW key_dependent_view_no_cols AS
--
-- CREATE OR REPLACE VIEW
--
-CREATE TABLE viewtest_tbl (a int, b int);
+CREATE TABLE viewtest_tbl (a int, b int, c numeric(10,1), d text COLLATE "C");
COPY viewtest_tbl FROM stdin;
CREATE OR REPLACE VIEW viewtest AS
SELECT * FROM viewtest_tbl;
CREATE OR REPLACE VIEW viewtest AS
SELECT * FROM viewtest_tbl WHERE a > 10;
SELECT * FROM viewtest;
- a | b
-----+----
- 15 | 20
- 20 | 25
+ a | b | c | d
+----+----+-----+-------
+ 15 | 20 | 3.3 | xyzz
+ 20 | 25 | 4.4 | xyzzy
(2 rows)
CREATE OR REPLACE VIEW viewtest AS
- SELECT a, b FROM viewtest_tbl WHERE a > 5 ORDER BY b DESC;
+ SELECT a, b, c, d FROM viewtest_tbl WHERE a > 5 ORDER BY b DESC;
SELECT * FROM viewtest;
- a | b
-----+----
- 20 | 25
- 15 | 20
- 10 | 15
+ a | b | c | d
+----+----+-----+-------
+ 20 | 25 | 4.4 | xyzzy
+ 15 | 20 | 3.3 | xyzz
+ 10 | 15 | 2.2 | xyz
(3 rows)
-- should fail
@@ -88,11 +88,19 @@ ERROR: cannot change name of view column "a" to "?column?"
HINT: Use ALTER VIEW ... RENAME COLUMN ... to change name of view column instead.
-- should fail
CREATE OR REPLACE VIEW viewtest AS
- SELECT a, b::numeric FROM viewtest_tbl;
+ SELECT a, b::numeric, c, d FROM viewtest_tbl;
ERROR: cannot change data type of view column "b" from integer to numeric
+-- should fail
+CREATE OR REPLACE VIEW viewtest AS
+ SELECT a, b, c::numeric(10,2), d FROM viewtest_tbl;
+ERROR: cannot change data type of view column "c" from numeric(10,1) to numeric(10,2)
+-- should fail
+CREATE OR REPLACE VIEW viewtest AS
+ SELECT a, b, c, d COLLATE "POSIX" FROM viewtest_tbl;
+ERROR: cannot change collation of view column "d" from "C" to "POSIX"
-- should work
CREATE OR REPLACE VIEW viewtest AS
- SELECT a, b, 0 AS c FROM viewtest_tbl;
+ SELECT a, b, c, d, 0 AS e FROM viewtest_tbl;
DROP VIEW viewtest;
DROP TABLE viewtest_tbl;
-- tests for temporary views