jsonpath_encoding.err 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <sql-statement>
  2. --
  3. -- encoding-sensitive tests for jsonpath
  4. --
  5. SELECT getdatabaseencoding(); -- just to label the results files
  6. </sql-statement>
  7. <sql-statement>
  8. -- checks for double-quoted values
  9. -- basic unicode input
  10. SELECT '"\u"'::jsonpath; -- ERROR, incomplete escape
  11. </sql-statement>
  12. -stdin-:<main>: Fatal: Execution
  13. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  14. -- checks for double-quoted values
  15. ^
  16. -stdin-:<main>:1:1: Fatal: ERROR: invalid unicode sequence at or near "\u" of jsonpath input
  17. -- checks for double-quoted values
  18. ^
  19. <sql-statement>
  20. SELECT '"\u00"'::jsonpath; -- ERROR, incomplete escape
  21. </sql-statement>
  22. -stdin-:<main>: Fatal: Execution
  23. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  24. SELECT '"\u00"'::jsonpath; -- ERROR, incomplete escape
  25. ^
  26. -stdin-:<main>:1:1: Fatal: ERROR: invalid unicode sequence at or near "\u00" of jsonpath input
  27. SELECT '"\u00"'::jsonpath; -- ERROR, incomplete escape
  28. ^
  29. <sql-statement>
  30. SELECT '"\u000g"'::jsonpath; -- ERROR, g is not a hex digit
  31. </sql-statement>
  32. -stdin-:<main>: Fatal: Execution
  33. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  34. SELECT '"\u000g"'::jsonpath; -- ERROR, g is not a hex digit
  35. ^
  36. -stdin-:<main>:1:1: Fatal: ERROR: invalid unicode sequence at or near "\u000" of jsonpath input
  37. SELECT '"\u000g"'::jsonpath; -- ERROR, g is not a hex digit
  38. ^
  39. <sql-statement>
  40. SELECT '"\u0000"'::jsonpath; -- OK, legal escape
  41. </sql-statement>
  42. -stdin-:<main>: Fatal: Execution
  43. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  44. SELECT '"\u0000"'::jsonpath; -- OK, legal escape
  45. ^
  46. -stdin-:<main>:1:1: Fatal: ERROR: unsupported Unicode escape sequence
  47. DETAIL: \u0000 cannot be converted to text.
  48. SELECT '"\u0000"'::jsonpath; -- OK, legal escape
  49. ^
  50. <sql-statement>
  51. SELECT '"\uaBcD"'::jsonpath; -- OK, uppercase and lower case both OK
  52. </sql-statement>
  53. <sql-statement>
  54. -- handling of unicode surrogate pairs
  55. select '"\ud83d\ude04\ud83d\udc36"'::jsonpath as correct_in_utf8;
  56. </sql-statement>
  57. <sql-statement>
  58. select '"\ud83d\ud83d"'::jsonpath; -- 2 high surrogates in a row
  59. </sql-statement>
  60. -stdin-:<main>: Fatal: Execution
  61. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  62. select '"\ud83d\ud83d"'::jsonpath; -- 2 high surrogates in a row
  63. ^
  64. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type jsonpath
  65. DETAIL: Unicode high surrogate must not follow a high surrogate.
  66. select '"\ud83d\ud83d"'::jsonpath; -- 2 high surrogates in a row
  67. ^
  68. <sql-statement>
  69. select '"\ude04\ud83d"'::jsonpath; -- surrogates in wrong order
  70. </sql-statement>
  71. -stdin-:<main>: Fatal: Execution
  72. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  73. select '"\ude04\ud83d"'::jsonpath; -- surrogates in wrong order
  74. ^
  75. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type jsonpath
  76. DETAIL: Unicode low surrogate must follow a high surrogate.
  77. select '"\ude04\ud83d"'::jsonpath; -- surrogates in wrong order
  78. ^
  79. <sql-statement>
  80. select '"\ud83dX"'::jsonpath; -- orphan high surrogate
  81. </sql-statement>
  82. -stdin-:<main>: Fatal: Execution
  83. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  84. select '"\ud83dX"'::jsonpath; -- orphan high surrogate
  85. ^
  86. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type jsonpath
  87. DETAIL: Unicode low surrogate must follow a high surrogate.
  88. select '"\ud83dX"'::jsonpath; -- orphan high surrogate
  89. ^
  90. <sql-statement>
  91. select '"\ude04X"'::jsonpath; -- orphan low surrogate
  92. </sql-statement>
  93. -stdin-:<main>: Fatal: Execution
  94. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  95. select '"\ude04X"'::jsonpath; -- orphan low surrogate
  96. ^
  97. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type jsonpath
  98. DETAIL: Unicode low surrogate must follow a high surrogate.
  99. select '"\ude04X"'::jsonpath; -- orphan low surrogate
  100. ^
  101. <sql-statement>
  102. --handling of simple unicode escapes
  103. select '"the Copyright \u00a9 sign"'::jsonpath as correct_in_utf8;
  104. </sql-statement>
  105. <sql-statement>
  106. select '"dollar \u0024 character"'::jsonpath as correct_everywhere;
  107. </sql-statement>
  108. <sql-statement>
  109. select '"dollar \\u0024 character"'::jsonpath as not_an_escape;
  110. </sql-statement>
  111. <sql-statement>
  112. select '"null \u0000 escape"'::jsonpath as not_unescaped;
  113. </sql-statement>
  114. -stdin-:<main>: Fatal: Execution
  115. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  116. select '"null \u0000 escape"'::jsonpath as not_unescaped;
  117. ^
  118. -stdin-:<main>:1:1: Fatal: ERROR: unsupported Unicode escape sequence
  119. DETAIL: \u0000 cannot be converted to text.
  120. select '"null \u0000 escape"'::jsonpath as not_unescaped;
  121. ^
  122. <sql-statement>
  123. select '"null \\u0000 escape"'::jsonpath as not_an_escape;
  124. </sql-statement>
  125. <sql-statement>
  126. -- checks for quoted key names
  127. -- basic unicode input
  128. SELECT '$."\u"'::jsonpath; -- ERROR, incomplete escape
  129. </sql-statement>
  130. -stdin-:<main>: Fatal: Execution
  131. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  132. -- checks for quoted key names
  133. ^
  134. -stdin-:<main>:1:1: Fatal: ERROR: invalid unicode sequence at or near "\u" of jsonpath input
  135. -- checks for quoted key names
  136. ^
  137. <sql-statement>
  138. SELECT '$."\u00"'::jsonpath; -- ERROR, incomplete escape
  139. </sql-statement>
  140. -stdin-:<main>: Fatal: Execution
  141. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  142. SELECT '$."\u00"'::jsonpath; -- ERROR, incomplete escape
  143. ^
  144. -stdin-:<main>:1:1: Fatal: ERROR: invalid unicode sequence at or near "\u00" of jsonpath input
  145. SELECT '$."\u00"'::jsonpath; -- ERROR, incomplete escape
  146. ^
  147. <sql-statement>
  148. SELECT '$."\u000g"'::jsonpath; -- ERROR, g is not a hex digit
  149. </sql-statement>
  150. -stdin-:<main>: Fatal: Execution
  151. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  152. SELECT '$."\u000g"'::jsonpath; -- ERROR, g is not a hex digit
  153. ^
  154. -stdin-:<main>:1:1: Fatal: ERROR: invalid unicode sequence at or near "\u000" of jsonpath input
  155. SELECT '$."\u000g"'::jsonpath; -- ERROR, g is not a hex digit
  156. ^
  157. <sql-statement>
  158. SELECT '$."\u0000"'::jsonpath; -- OK, legal escape
  159. </sql-statement>
  160. -stdin-:<main>: Fatal: Execution
  161. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  162. SELECT '$."\u0000"'::jsonpath; -- OK, legal escape
  163. ^
  164. -stdin-:<main>:1:1: Fatal: ERROR: unsupported Unicode escape sequence
  165. DETAIL: \u0000 cannot be converted to text.
  166. SELECT '$."\u0000"'::jsonpath; -- OK, legal escape
  167. ^
  168. <sql-statement>
  169. SELECT '$."\uaBcD"'::jsonpath; -- OK, uppercase and lower case both OK
  170. </sql-statement>
  171. <sql-statement>
  172. -- handling of unicode surrogate pairs
  173. select '$."\ud83d\ude04\ud83d\udc36"'::jsonpath as correct_in_utf8;
  174. </sql-statement>
  175. <sql-statement>
  176. select '$."\ud83d\ud83d"'::jsonpath; -- 2 high surrogates in a row
  177. </sql-statement>
  178. -stdin-:<main>: Fatal: Execution
  179. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  180. select '$."\ud83d\ud83d"'::jsonpath; -- 2 high surrogates in a row
  181. ^
  182. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type jsonpath
  183. DETAIL: Unicode high surrogate must not follow a high surrogate.
  184. select '$."\ud83d\ud83d"'::jsonpath; -- 2 high surrogates in a row
  185. ^
  186. <sql-statement>
  187. select '$."\ude04\ud83d"'::jsonpath; -- surrogates in wrong order
  188. </sql-statement>
  189. -stdin-:<main>: Fatal: Execution
  190. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  191. select '$."\ude04\ud83d"'::jsonpath; -- surrogates in wrong order
  192. ^
  193. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type jsonpath
  194. DETAIL: Unicode low surrogate must follow a high surrogate.
  195. select '$."\ude04\ud83d"'::jsonpath; -- surrogates in wrong order
  196. ^
  197. <sql-statement>
  198. select '$."\ud83dX"'::jsonpath; -- orphan high surrogate
  199. </sql-statement>
  200. -stdin-:<main>: Fatal: Execution
  201. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  202. select '$."\ud83dX"'::jsonpath; -- orphan high surrogate
  203. ^
  204. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type jsonpath
  205. DETAIL: Unicode low surrogate must follow a high surrogate.
  206. select '$."\ud83dX"'::jsonpath; -- orphan high surrogate
  207. ^
  208. <sql-statement>
  209. select '$."\ude04X"'::jsonpath; -- orphan low surrogate
  210. </sql-statement>
  211. -stdin-:<main>: Fatal: Execution
  212. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  213. select '$."\ude04X"'::jsonpath; -- orphan low surrogate
  214. ^
  215. -stdin-:<main>:1:1: Fatal: ERROR: invalid input syntax for type jsonpath
  216. DETAIL: Unicode low surrogate must follow a high surrogate.
  217. select '$."\ude04X"'::jsonpath; -- orphan low surrogate
  218. ^
  219. <sql-statement>
  220. --handling of simple unicode escapes
  221. select '$."the Copyright \u00a9 sign"'::jsonpath as correct_in_utf8;
  222. </sql-statement>
  223. <sql-statement>
  224. select '$."dollar \u0024 character"'::jsonpath as correct_everywhere;
  225. </sql-statement>
  226. <sql-statement>
  227. select '$."dollar \\u0024 character"'::jsonpath as not_an_escape;
  228. </sql-statement>
  229. <sql-statement>
  230. select '$."null \u0000 escape"'::jsonpath as not_unescaped;
  231. </sql-statement>
  232. -stdin-:<main>: Fatal: Execution
  233. -stdin-:<main>:1:1: Fatal: Execution of node: Result
  234. select '$."null \u0000 escape"'::jsonpath as not_unescaped;
  235. ^
  236. -stdin-:<main>:1:1: Fatal: ERROR: unsupported Unicode escape sequence
  237. DETAIL: \u0000 cannot be converted to text.
  238. select '$."null \u0000 escape"'::jsonpath as not_unescaped;
  239. ^
  240. <sql-statement>
  241. select '$."null \\u0000 escape"'::jsonpath as not_an_escape;
  242. </sql-statement>