char.slt 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. #
  10. # This file is derived from the logic test suite in CockroachDB. The
  11. # original file was retrieved on June 10, 2019 from:
  12. #
  13. # https://github.com/cockroachdb/cockroach/blob/d2f7fbf5dd1fc1a099bbad790a2e1f7c60a66cc3/pkg/sql/logictest/testdata/logic_test/json_builtins
  14. #
  15. # The original source code is subject to the terms of the Apache
  16. # 2.0 license, a copy of which can be found in the LICENSE file at the
  17. # root of this repository.
  18. # Fixes database-issues#5212
  19. query T
  20. SELECT 'a'::character = 'a'::"char";
  21. ----
  22. true
  23. query error db error: ERROR: coalesce could not convert type char\(1\) to "char"
  24. SELECT pg_typeof(coalesce('1'::"char", '1'::char));
  25. # Fixes database-issues#5191
  26. query T
  27. SELECT 'a'::"char"::char;
  28. ----
  29. a
  30. query T
  31. SELECT pg_typeof('a'::"char"::char);
  32. ----
  33. character
  34. query T
  35. SELECT 'a'::"char"::varchar;
  36. ----
  37. a
  38. query T
  39. SELECT pg_typeof('a'::"char"::varchar);
  40. ----
  41. character
  42. query T
  43. SELECT 'a'::"char"::text;
  44. ----
  45. a
  46. query T
  47. SELECT pg_typeof('a'::"char"::text);
  48. ----
  49. text
  50. query T
  51. SELECT 'abc'::char::"char";
  52. ----
  53. a
  54. query T
  55. SELECT pg_typeof('abc'::char::"char");
  56. ----
  57. "char"
  58. query T
  59. SELECT 'abc'::varchar::"char";
  60. ----
  61. a
  62. query T
  63. SELECT pg_typeof('abc'::varchar::"char");
  64. ----
  65. "char"
  66. query T
  67. SELECT 'abc'::text::"char";
  68. ----
  69. a
  70. query T
  71. SELECT pg_typeof('abc'::text::"char");
  72. ----
  73. "char"
  74. # Fixes database-issues#5222
  75. query error db error: ERROR: coalesce could not convert type "char" to char
  76. SELECT COALESCE('a'::char, 'a'::"char");
  77. query error db error: ERROR: coalesce could not convert type "char" to varchar
  78. SELECT COALESCE('a'::varchar, 'a'::"char");
  79. query error db error: ERROR: coalesce could not convert type char\(1\) to "char"
  80. SELECT COALESCE('a'::"char", 'a'::char);
  81. query error db error: ERROR: coalesce could not convert type varchar to "char"
  82. SELECT COALESCE('a'::"char", 'a'::varchar);