123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- # 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.
- mode cockroach
- statement ok
- CREATE TABLE mv_input (key INT)
- statement ok
- INSERT INTO mv_input VALUES (1);
- statement ok
- CREATE MATERIALIZED VIEW anomalies AS SELECT sum(key)::INT FROM mv_input;
- query I
- SELECT * FROM anomalies
- ----
- 1
- statement ok
- CREATE CONTINUAL TASK audit_log ON INPUT anomalies AS (
- INSERT INTO audit_log SELECT * FROM anomalies WHERE sum IS NOT NULL;
- )
- query I
- SELECT * FROM audit_log
- ----
- 1
- statement ok
- INSERT INTO mv_input VALUES (2), (3)
- query I
- SELECT * FROM anomalies
- ----
- 6
- query I
- SELECT * FROM audit_log
- ----
- 1
- 6
|