Skip to content

Commit

Permalink
Testdrive test for PARTITION BY checks
Browse files Browse the repository at this point in the history
  • Loading branch information
bkirwi committed Nov 6, 2024
1 parent 2b7a1e6 commit 8b57601
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/testdrive/partition-by.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0.

# Tests for the new PARTITION BY syntax for persisted collections.

# First, check that the flag is disabled by default.

! CREATE MATERIALIZED VIEW integers (n) WITH (PARTITION BY (n)) AS VALUES (3), (2), (1);
contains:PARTITION BY

$ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
ALTER SYSTEM SET enable_collection_partition_by = true

> CREATE MATERIALIZED VIEW integers (n) WITH (PARTITION BY (n)) AS VALUES (3), (2), (1);

> CREATE MATERIALIZED VIEW integers_strings (n, m) WITH (PARTITION BY (n, m))
AS VALUES (3, 'three'), (2, 'two'), (1, 'one');

! CREATE MATERIALIZED VIEW out_of_order (n, m) WITH (PARTITION BY (m, n))
AS VALUES (3, 'three'), (2, 'two'), (1, 'one');
contains:PARTITION BY columns should be a prefix

! CREATE MATERIALIZED VIEW out_of_order (n, m) WITH (PARTITION BY (m))
AS VALUES (3, 'three'), (2, 'two'), (1, 'one');
contains:PARTITION BY columns should be a prefix

! CREATE MATERIALIZED VIEW unsupported_type (n, m) WITH (PARTITION BY (n, m))
AS VALUES (3, '[3]'::json), (2, '[2]'::json), (1, '[1]'::json);
contains:PARTITION BY column m has unsupported type

0 comments on commit 8b57601

Please sign in to comment.