# 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 big (key INT) statement ok CREATE TABLE small (key INT, val STRING) statement ok INSERT INTO small VALUES (1, 'v0') statement ok CREATE CONTINUAL TASK stj ON INPUT big AS ( INSERT INTO stj SELECT b.key AS k, s.val AS v FROM big b JOIN small s ON b.key = s.key; ) # Can rename columns via AS when we don't specify them explictly in the CT query TTTT SHOW COLUMNS FROM stj; ---- k true integer (empty) v true text (empty) statement ok INSERT INTO big VALUES (1) query IT SELECT * FROM stj ---- 1 v0 statement ok UPDATE small SET val = 'v1' statement ok INSERT INTO big VALUES (1) query IT SELECT * FROM stj ---- 1 v0 1 v1