github-3281.td 1014 B

123456789101112131415161718192021222324
  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. # Regression test for https://github.com/MaterializeInc/database-issues/issues/1056.
  10. #
  11. # Verifies that the precedence of `->>`, `::`, and `CAST` are not mishandled
  12. # when rendering a SQL statement.
  13. # With the `--validate-data-dir` option, which is enabled in CI, Testdrive
  14. # will verify that views can be persisted and reloaded from the catalog, so the
  15. # very presence of this once-buggy view is a sufficient test.
  16. > CREATE MATERIALIZED VIEW v AS
  17. SELECT CAST (column1::jsonb->>'arrival_time' AS timestamptz) arrival_time
  18. FROM (VALUES ('{"arrival_time":"2020-05-04T13:07:41-04:00"}')) _
  19. > SELECT * FROM v
  20. "2020-05-04 17:07:41 UTC"