ct_errors.slt 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. mode cockroach
  10. statement ok
  11. CREATE TABLE foo (key INT)
  12. simple conn=mz_system,user=mz_system
  13. ALTER SYSTEM SET enable_continual_task_create = false
  14. ----
  15. COMPLETE 0
  16. statement error CREATE CONTINUAL TASK is not available
  17. CREATE CONTINUAL TASK nope (key INT) ON INPUT foo AS (
  18. INSERT INTO nope SELECT * FROM foo;
  19. )
  20. simple conn=mz_system,user=mz_system
  21. ALTER SYSTEM SET enable_continual_task_create = true
  22. ----
  23. COMPLETE 0
  24. # INSERT columns do not match
  25. statement error statement 0: column "key" is of type boolean but expression is of type integer
  26. CREATE CONTINUAL TASK nope (key BOOL) ON INPUT foo AS (
  27. INSERT INTO nope SELECT * FROM foo;
  28. )
  29. statement error statement 0: INSERT has more target columns than expressions
  30. CREATE CONTINUAL TASK nope (key INT) ON INPUT foo AS (
  31. INSERT INTO nope SELECT FROM foo;
  32. )
  33. statement error statement 0: INSERT has more expressions than target columns
  34. CREATE CONTINUAL TASK nope (key INT) ON INPUT foo AS (
  35. INSERT INTO nope SELECT *, 'nope' FROM foo;
  36. )
  37. # Cannot use a VIEW (or other things not directly backed by a persist shard) as
  38. # an input.
  39. statement ok
  40. CREATE VIEW some_view AS SELECT *, 'bar' FROM foo;
  41. statement error CONTINUAL TASK cannot use view as an input
  42. CREATE CONTINUAL TASK nope (key INT, val STRING) ON INPUT some_view AS (
  43. INSERT INTO nope SELECT * FROM foo;
  44. )
  45. # Must provide columns for recursive CTs
  46. statement error statement 1: INSERT has more expressions than target columns
  47. CREATE CONTINUAL TASK nope ON INPUT foo AS (
  48. DELETE FROM nope;
  49. INSERT INTO nope SELECT *, 'bar' FROM foo;
  50. )