diff options
| author | Bruce Momjian | 2008-12-06 23:22:46 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2008-12-06 23:22:46 +0000 |
| commit | ff1ea2173a92dea975d399a4ca25723f83762e55 (patch) | |
| tree | 27154ef5dd7d7a9ace834a3b0e5df557c05eaf2f /src/test | |
| parent | 31076c8beb05cb2f1d8bcaf87d769b7b2cd7524a (diff) | |
Allow CREATE OR REPLACE VIEW to add columns to the _end_ of the view.
Robert Haas
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/create_view.out | 7 | ||||
| -rw-r--r-- | src/test/regress/sql/create_view.sql | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/test/regress/expected/create_view.out b/src/test/regress/expected/create_view.out index cbee9dceed8..e9b6c83e25d 100644 --- a/src/test/regress/expected/create_view.out +++ b/src/test/regress/expected/create_view.out @@ -49,15 +49,18 @@ SELECT * FROM viewtest; -- should fail CREATE OR REPLACE VIEW viewtest AS SELECT a FROM viewtest_tbl WHERE a <> 20; -ERROR: cannot change number of columns in view +ERROR: cannot drop columns from view -- should fail CREATE OR REPLACE VIEW viewtest AS SELECT 1, * FROM viewtest_tbl; -ERROR: cannot change number of columns in view +ERROR: column "b" of relation "viewtest" already exists -- should fail CREATE OR REPLACE VIEW viewtest AS SELECT a, b::numeric FROM viewtest_tbl; ERROR: cannot change data type of view column "b" +-- should work +CREATE OR REPLACE VIEW viewtest AS + SELECT a, b, 0 AS c FROM viewtest_tbl; DROP VIEW viewtest; DROP TABLE viewtest_tbl; -- tests for temporary views diff --git a/src/test/regress/sql/create_view.sql b/src/test/regress/sql/create_view.sql index 30a9bb1152d..f8942c93f5c 100644 --- a/src/test/regress/sql/create_view.sql +++ b/src/test/regress/sql/create_view.sql @@ -61,6 +61,10 @@ CREATE OR REPLACE VIEW viewtest AS CREATE OR REPLACE VIEW viewtest AS SELECT a, b::numeric FROM viewtest_tbl; +-- should work +CREATE OR REPLACE VIEW viewtest AS + SELECT a, b, 0 AS c FROM viewtest_tbl; + DROP VIEW viewtest; DROP TABLE viewtest_tbl; |
