Skip to content

Commit cc87aae

Browse files
committed
Testdrive test for PARTITION BY checks
1 parent 45307bd commit cc87aae

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

test/testdrive/partition-by.td

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
10+
# Tests for the new PARTITION BY syntax for persisted collections.
11+
12+
# First, check that the flag is disabled by default.
13+
14+
! CREATE MATERIALIZED VIEW integers (n) PARTITION BY (n) AS VALUES (3), (2), (1);
15+
contains:PARTITION BY
16+
17+
$ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
18+
ALTER SYSTEM SET partition_by = true
19+
20+
> CREATE MATERIALIZED VIEW integers (n) PARTITION BY (n) AS VALUES (3), (2), (1);
21+
22+
> CREATE MATERIALIZED VIEW integers_strings (n, m) PARTITION BY (n, m)
23+
AS VALUES (3, 'three'), (2, 'two'), (1, 'one');
24+
25+
! CREATE MATERIALIZED VIEW out_of_order (n, m) PARTITION BY (m, n)
26+
AS VALUES (3, 'three'), (2, 'two'), (1, 'one');
27+
contains:PARTITION BY columns should be a prefix
28+
29+
! CREATE MATERIALIZED VIEW out_of_order (n, m) PARTITION BY (m)
30+
AS VALUES (3, 'three'), (2, 'two'), (1, 'one');
31+
contains:PARTITION BY columns should be a prefix
32+
33+
! CREATE MATERIALIZED VIEW unsupported_type (n, m) PARTITION BY (n, m)
34+
AS VALUES (3, '[3]'::json), (2, '[2]'::json), (1, '[1]'::json);
35+
contains:PARTITION BY column m has unsupported type

0 commit comments

Comments
 (0)