quote_ident.slt 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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. query T
  10. SELECT quote_ident('xyz');
  11. ----
  12. xyz
  13. query T
  14. SELECT quote_ident('XyZ');
  15. ----
  16. "XyZ"
  17. query T
  18. SELECT quote_ident('xyZ');
  19. ----
  20. "xyZ"
  21. query T
  22. SELECT quote_ident('"xyz"');
  23. ----
  24. """xyz"""
  25. query T
  26. SELECT quote_ident('');
  27. ----
  28. ""
  29. query T
  30. SELECT quote_ident('""');
  31. ----
  32. """"""
  33. query T
  34. SELECT quote_ident('"');
  35. ----
  36. """"
  37. query T
  38. SELECT quote_ident(NULL);
  39. ----
  40. NULL
  41. query T
  42. SELECT quote_ident('NULL');
  43. ----
  44. "NULL"
  45. query T
  46. SELECT quote_ident('"NULL"');
  47. ----
  48. """NULL"""
  49. query T
  50. SELECT quote_ident('"xyz');
  51. ----
  52. """xyz"
  53. query T
  54. SELECT quote_ident('xyz"');
  55. ----
  56. "xyz"""
  57. query T
  58. SELECT quote_ident('wx"yz"');
  59. ----
  60. "wx""yz"""
  61. query T
  62. SELECT quote_ident('xyz_abc');
  63. ----
  64. xyz_abc
  65. query T
  66. SELECT quote_ident('Xyz_Abc');
  67. ----
  68. "Xyz_Abc"
  69. query T
  70. SELECT quote_ident('xyZ_Abc');
  71. ----
  72. "xyZ_Abc"
  73. query T
  74. SELECT quote_ident('xyz_123');
  75. ----
  76. xyz_123
  77. query T
  78. SELECT quote_ident('Xyz_123');
  79. ----
  80. "Xyz_123"
  81. query T
  82. SELECT quote_ident('xyz abc');
  83. ----
  84. "xyz abc"
  85. query T
  86. SELECT quote_ident('Xyz Abc');
  87. ----
  88. "Xyz Abc"
  89. query T
  90. SELECT quote_ident('xyZ Abc');
  91. ----
  92. "xyZ Abc"
  93. query T
  94. SELECT quote_ident('xyz_abc123');
  95. ----
  96. xyz_abc123
  97. query T
  98. SELECT quote_ident('Xyz_Abc123');
  99. ----
  100. "Xyz_Abc123"
  101. query T
  102. SELECT quote_ident('123_xyz');
  103. ----
  104. "123_xyz"
  105. query T
  106. SELECT quote_ident('123_Xyz');
  107. ----
  108. "123_Xyz"
  109. query T
  110. SELECT quote_ident('xyz_abc_123');
  111. ----
  112. xyz_abc_123
  113. query T
  114. SELECT quote_ident('Xyz_Abc_123');
  115. ----
  116. "Xyz_Abc_123"
  117. query T
  118. SELECT quote_ident('xyz_123_abc');
  119. ----
  120. xyz_123_abc
  121. query T
  122. SELECT quote_ident('Xyz_123_Abc');
  123. ----
  124. "Xyz_123_Abc"
  125. query T
  126. SELECT quote_ident('xyz 123 abc');
  127. ----
  128. "xyz 123 abc"
  129. query T
  130. SELECT quote_ident('Xyz 123 Abc');
  131. ----
  132. "Xyz 123 Abc"
  133. query T
  134. SELECT quote_ident('xyz_abc_123');
  135. ----
  136. xyz_abc_123
  137. query T
  138. SELECT quote_ident('Xyz_Abc_123');
  139. ----
  140. "Xyz_Abc_123"
  141. query T
  142. SELECT quote_ident('_xyz_abc');
  143. ----
  144. _xyz_abc
  145. query T
  146. SELECT quote_ident('_Xyz_Abc');
  147. ----
  148. "_Xyz_Abc"
  149. query T
  150. SELECT quote_ident('_xyz_abc_123');
  151. ----
  152. _xyz_abc_123
  153. query T
  154. SELECT quote_ident('_Xyz_Abc_123');
  155. ----
  156. "_Xyz_Abc_123"
  157. query T
  158. SELECT quote_ident('_123_xyz_abc');
  159. ----
  160. _123_xyz_abc
  161. query T
  162. SELECT quote_ident('_123_Xyz_Abc');
  163. ----
  164. "_123_Xyz_Abc"
  165. query T
  166. SELECT quote_ident('_xyz_abc_123_');
  167. ----
  168. _xyz_abc_123_
  169. query T
  170. SELECT quote_ident('_Xyz_Abc_123_');
  171. ----
  172. "_Xyz_Abc_123_"
  173. query T
  174. SELECT quote_ident('_123_xyz_abc_');
  175. ----
  176. _123_xyz_abc_
  177. query T
  178. SELECT quote_ident('_123_Xyz_Abc_');
  179. ----
  180. "_123_Xyz_Abc_"
  181. query T
  182. SELECT quote_ident('_xyz 123 abc_');
  183. ----
  184. "_xyz 123 abc_"
  185. query T
  186. SELECT quote_ident('_Xyz 123 Abc_');
  187. ----
  188. "_Xyz 123 Abc_"
  189. query T
  190. SELECT quote_ident('xyz "abc"');
  191. ----
  192. "xyz ""abc"""
  193. query T
  194. SELECT quote_ident('Xyz "Abc"');
  195. ----
  196. "Xyz ""Abc"""
  197. query T
  198. SELECT quote_ident('xyZ "Abc"');
  199. ----
  200. "xyZ ""Abc"""
  201. query T
  202. SELECT quote_ident('he"llo_wor"ld');
  203. ----
  204. "he""llo_wor""ld"
  205. query T
  206. SELECT quote_ident('He"Llo_Wor"Ld');
  207. ----
  208. "He""Llo_Wor""Ld"
  209. query T
  210. SELECT quote_ident('xyz_123 "abc"');
  211. ----
  212. "xyz_123 ""abc"""
  213. query T
  214. SELECT quote_ident('Xyz_123 "Abc"');
  215. ----
  216. "Xyz_123 ""Abc"""
  217. query T
  218. SELECT quote_ident('123_xyz_abc');
  219. ----
  220. "123_xyz_abc"
  221. query T
  222. SELECT quote_ident('123_Xyz_Abc');
  223. ----
  224. "123_Xyz_Abc"
  225. query T
  226. SELECT quote_ident('xyz abc 123');
  227. ----
  228. "xyz abc 123"
  229. query T
  230. SELECT quote_ident('Xyz Abc 123');
  231. ----
  232. "Xyz Abc 123"
  233. query T
  234. SELECT quote_ident('🌍');
  235. ----
  236. "🌍"
  237. query T
  238. SELECT quote_ident(' 🌍 ');
  239. ----
  240. " 🌍 "
  241. query T
  242. SELECT quote_ident(' 🌍 " ');
  243. ----
  244. " 🌍 "" "
  245. query T
  246. SELECT quote_ident(' 🌍 " ');
  247. ----
  248. " 🌍 "" "
  249. query T
  250. SELECT quote_ident(' xyz 🌍 ');
  251. ----
  252. " xyz 🌍 "
  253. query T
  254. SELECT quote_ident(' xyZ 🌍 ');
  255. ----
  256. " xyZ 🌍 "
  257. # Reserved keyword
  258. query T
  259. SELECT quote_ident('with');
  260. ----
  261. "with"
  262. query T
  263. SELECT quote_ident('natural');
  264. ----
  265. "natural"
  266. query T
  267. SELECT quote_ident('second');
  268. ----
  269. "second"
  270. # Unreserved keyword
  271. query T
  272. SELECT quote_ident('materialize');
  273. ----
  274. materialize
  275. query T
  276. SELECT quote_ident('table');
  277. ----
  278. table
  279. simple
  280. SELECT quote_ident('this ident is too long and will return an error 🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎')
  281. ----
  282. db error: ERROR: string is not a valid identifier: "this ident is too long and will return an error 🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎"
  283. DETAIL: identifier too long (len: 272, max: 255, value: "this ident is too long and will return an error 🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎🌎")