github-6388.slt 886 B

12345678910111213141516171819202122232425262728
  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. # Regression test for
  11. # https://github.com/MaterializeInc/database-issues/issues/6388.
  12. statement ok
  13. CREATE TABLE r(x bool);
  14. statement ok
  15. CREATE VIEW v AS SELECT nullif(to_jsonb(true), to_jsonb(x)) as y FROM r;
  16. # When the bug is present, the type of `y` is wrongly computed as `boolean` when
  17. # the `(true, _)` simplification of the `case` statement resulting from the
  18. # desugared `nullif` is triggered in `MirScalarExpr::reduce`.
  19. query TTTT
  20. SHOW COLUMNS from v;
  21. ----
  22. y true jsonb (empty)