runtime-errors.td 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. > CREATE TABLE data (id text, a bigint, b bigint)
  10. > INSERT INTO data VALUES ('valid1', 2, 1), ('valid2', 17, 5)
  11. > CREATE MATERIALIZED VIEW multiply AS SELECT id, a * b AS product FROM data
  12. > CREATE MATERIALIZED VIEW divide AS SELECT id, a / b AS quotient FROM data
  13. > CREATE MATERIALIZED VIEW both AS
  14. SELECT * FROM multiply NATURAL JOIN divide
  15. > SELECT * FROM both
  16. valid1 2 2
  17. valid2 85 3
  18. > INSERT INTO data VALUES ('bad1', 7, 0)
  19. > SELECT * FROM multiply
  20. valid1 2
  21. valid2 85
  22. bad1 0
  23. ! SELECT * FROM divide
  24. contains:division by zero
  25. ! SELECT * FROM both
  26. contains:division by zero
  27. > DELETE FROM data WHERE id = 'bad1'
  28. > SELECT * FROM both
  29. valid1 2 2
  30. valid2 85 3