create-in-v0.131.0-alter-table.td 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. $ postgres-connect name=mz_system url=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  10. $ postgres-execute connection=mz_system
  11. ALTER SYSTEM SET enable_alter_table_add_column = true;
  12. > CREATE TABLE alter_table_t1 (a int);
  13. > INSERT INTO alter_table_t1 VALUES (100), (NULL);
  14. > CREATE VIEW alter_table_t1_v1 AS SELECT * FROM alter_table_t1;
  15. > CREATE MATERIALIZED VIEW alter_table_t1_mv1 AS SELECT * FROM alter_table_t1_v1;
  16. > ALTER TABLE alter_table_t1 ADD COLUMN b text;
  17. > INSERT INTO alter_table_t1 VALUES (200, 'hello'), (300, NULL), (400, 'world');
  18. > CREATE VIEW alter_table_t1_v2 AS SELECT * FROM alter_table_t1;
  19. > CREATE MATERIALIZED VIEW alter_table_t1_mv2 AS SELECT * FROM alter_table_t1_v1;
  20. > ALTER TABLE alter_table_t1 ADD COLUMN c bigint;
  21. > INSERT INTO alter_table_t1 VALUES (500, 'apple', 101), (600, 'orange', NULL);