custom_escape_character.slt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # Copyright 2015 - 2019 The Cockroach Authors. All rights reserved.
  2. # Copyright Materialize, Inc. and contributors. All rights reserved.
  3. #
  4. # Use of this software is governed by the Business Source License
  5. # included in the LICENSE file at the root of this repository.
  6. #
  7. # As of the Change Date specified in that file, in accordance with
  8. # the Business Source License, use of this software will be governed
  9. # by the Apache License, Version 2.0.
  10. #
  11. # This file is derived from the logic test suite in CockroachDB. The
  12. # original file was retrieved on June 10, 2019 from:
  13. #
  14. # https://github.com/cockroachdb/cockroach/blob/d2f7fbf5dd1fc1a099bbad790a2e1f7c60a66cc3/pkg/sql/logictest/testdata/logic_test/custom_escape_character
  15. #
  16. # The original source code is subject to the terms of the Apache
  17. # 2.0 license, a copy of which can be found in the LICENSE file at the
  18. # root of this repository.
  19. # not supported yet
  20. halt
  21. mode cockroach
  22. query B
  23. SELECT '%' LIKE 't%' ESCAPE CASE WHEN (SELECT '-A' SIMILAR TO '--A' ESCAPE '-') THEN 't' ELSE 'f' END
  24. ----
  25. true
  26. query B
  27. SELECT '%' LIKE 't%' ESCAPE CASE WHEN (SELECT 'A' SIMILAR TO '-A' ESCAPE '') THEN 't' ELSE 'f' END
  28. ----
  29. false
  30. query B
  31. SELECT '%bC' ILIKE 't%Bc' ESCAPE CASE WHEN (SELECT 'A' ILIKE '-a' ESCAPE '-') THEN 't' ELSE 'f' END
  32. ----
  33. true
  34. query B
  35. SELECT 'A' LIKE '\A' ESCAPE '\'
  36. ----
  37. true
  38. query B
  39. SELECT 'A' LIKE '\A' ESCAPE ''
  40. ----
  41. false
  42. query B
  43. SELECT '%A' LIKE '_A' ESCAPE '%'
  44. ----
  45. true
  46. query B
  47. SELECT '%A' LIKE '%A' ESCAPE '%'
  48. ----
  49. false
  50. query B
  51. SELECT '%A' LIKE '%%A' ESCAPE '%'
  52. ----
  53. true
  54. query B
  55. SELECT '春A' LIKE '春春_' ESCAPE '春'
  56. ----
  57. true
  58. query error invalid escape string
  59. SELECT 'A' LIKE 'AA' ESCAPE 'AA'
  60. query error invalid escape string
  61. SELECT '春A' LIKE '春春_' ESCAPE '春春'
  62. query B
  63. SELECT 'A' SIMILAR TO '\A' ESCAPE '\'
  64. ----
  65. false
  66. query B
  67. SELECT '\A' SIMILAR TO '\A' ESCAPE ''
  68. ----
  69. true
  70. query B
  71. SELECT '%A' SIMILAR TO '_A' ESCAPE '%'
  72. ----
  73. true
  74. query B
  75. SELECT '%A' SIMILAR TO '%A' ESCAPE '%'
  76. ----
  77. false
  78. query B
  79. SELECT '123A_' SIMILAR TO '%A_' ESCAPE '_'
  80. ----
  81. false
  82. query B
  83. SELECT '123A_' SIMILAR TO '%A__' ESCAPE '_'
  84. ----
  85. true
  86. query B
  87. SELECT '春A' SIMILAR TO '春春_' ESCAPE '春'
  88. ----
  89. true
  90. query B
  91. SELECT '春A_春春' SIMILAR TO '%_春_%' ESCAPE '春'
  92. ----
  93. true
  94. query error invalid escape string
  95. SELECT 'A' SIMILAR TO 'AA' ESCAPE 'AA'
  96. query error invalid escape string
  97. SELECT '春A' SIMILAR TO '春春_' ESCAPE '春春'