1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
SET extra_float_digits = 0;
LOAD 'age';
SET search_path TO ag_catalog;
SELECT create_graph('scan');
SELECT create_graph('scan');
--
-- multi-line comment
--
SELECT * FROM cypher('scan', $$
/*
* multi-line comment
*/
RETURN 0
/**/
$$) AS t(a agtype);
SELECT * FROM cypher('scan', $$
/* unterminated /* comment
RETURN 0
$$) AS t(a int);
-- recover syntax highlighting */ */
--
-- single-line comment
--
SELECT * FROM cypher('scan', $$
// single-line
// comment
RETURN 0
$$) AS t(a agtype);
--
-- decimal integer
--
SELECT * FROM cypher('scan', $$
RETURN 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
$$) AS t(a agtype, b agtype, c agtype, d agtype, e agtype,
f agtype, g agtype, h agtype, i agtype, j agtype);
SELECT * FROM cypher('scan', $$
RETURN 11, 22, 33, 44, 55, 66, 77, 88, 99
$$) AS t(a agtype, b agtype, c agtype, d agtype, e agtype,
f agtype, g agtype, h agtype, i agtype);
-- 2^31 - 1, 2^31
SELECT * FROM cypher('scan', $$
RETURN 2147483647, 2147483648
$$) AS t(a agtype, b agtype);
--
-- octal integer
--
SELECT * FROM cypher('scan', $$
RETURN 00, 01, 02, 03, 04, 05, 06, 07, 010
$$) AS t(a agtype, b agtype, c agtype, d agtype, e agtype,
f agtype, g agtype, h agtype, i agtype);
SELECT * FROM cypher('scan', $$
RETURN 000, 011, 022, 033, 044, 055, 066, 077
$$) AS t(a agtype, b agtype, c agtype, d agtype, e agtype,
f agtype, g agtype, h agtype);
-- 2^31 - 1, 2^31
SELECT * FROM cypher('scan', $$
RETURN 000000000000, 017777777777, 0020000000000
$$) AS t(a agtype, b agtype, c agtype);
-- 2^60 - 1, 2^64 - 1
SELECT * FROM cypher('scan', $$
RETURN 077777777777777777777, 01777777777777777777777
$$) AS t(a agtype, b agtype);
-- an invalid character after reading valid digits
SELECT * FROM cypher('scan', $$
RETURN 012345678
$$) AS t(a int);
-- an invalid character after the leading "0"
SELECT * FROM cypher('scan', $$
RETURN 09
$$) AS t(a int);
--
-- hexadecimal integer
--
SELECT * FROM cypher('scan', $$
RETURN 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9
$$) AS t(a agtype, b agtype, c agtype, d agtype, e agtype,
f agtype, g agtype, h agtype, i agtype, j agtype);
SELECT * FROM cypher('scan', $$
RETURN 0xA, 0xB, 0xC, 0xD, 0xE, 0xF
$$) AS t(a agtype, b agtype, c agtype, d agtype, e agtype, f agtype);
SELECT * FROM cypher('scan', $$
RETURN 0X00, 0X11, 0X22, 0X33, 0X44, 0X55, 0X66, 0X77, 0X88, 0X99
$$) AS t(a agtype, b agtype, c agtype, d agtype, e agtype,
f agtype, g agtype, h agtype, i agtype, j agtype);
SELECT * FROM cypher('scan', $$
RETURN 0XAa, 0XBb, 0XCc, 0XDd, 0XEe, 0xFf
$$) AS t(a agtype, b agtype, c agtype, d agtype, e agtype, f agtype);
-- 2^31 - 1, 2^31
SELECT * FROM cypher('scan', $$
RETURN 0x00000000, 0x7FFFFFFF, 0x080000000
$$) AS t(a agtype, b agtype, c agtype);
-- 10^18, 2^64 - 1
SELECT * FROM cypher('scan', $$
RETURN 0xde0b6b3a7640000, 0xffffffffffffffff
$$) AS t(a agtype, b agtype);
-- an invalid character after reading valid digits
SELECT * FROM cypher('scan', $$
RETURN 0xF~
$$) AS t(a int);
-- an invalid character after the leading "0x"
SELECT * FROM cypher('scan', $$
RETURN 0x~
$$) AS t(a int);
-- "0x" followed by nothing
SELECT * FROM cypher('scan', $$
RETURN 0x
$$) AS t(a int);
--
-- decimal
--
SELECT * FROM cypher('scan', $$
RETURN 03., 3.141592, .141592
$$) AS t(a agtype, b agtype, c agtype);
-- "0" and ".."
SELECT * FROM cypher('scan', $$
RETURN 0..
$$) AS t(a text, b text, c text);
--
-- scientific notation
--
SELECT * FROM cypher('scan', $$
RETURN 3141592e-6, 3.141592E0, .3141592e+1
$$) AS t(a agtype, b agtype, c agtype);
-- invalid exponent parts
SELECT * FROM cypher('scan', $$
RETURN 3141592e-
$$) AS t(a text);
SELECT * FROM cypher('scan', $$
RETURN 3.141592E
$$) AS t(a text);
SELECT * FROM cypher('scan', $$
RETURN .3141592e+
$$) AS t(a text);
--
-- quoted string
--
-- a long string
SELECT * FROM cypher('scan', $$
RETURN " !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
$$) AS t(a agtype);
-- escape sequences
SELECT * FROM cypher('scan', $$
RETURN " \" \" ' \' ", ' \' \' " \" ', " / \/ \\ \b \f \n \r \t "
$$) AS t(a agtype, b agtype, c agtype);
-- invalid escape sequence
SELECT * FROM cypher('scan', $$
RETURN "\a"
$$) AS t(a text);
-- Unicode escape sequences
SELECT * FROM cypher('scan', $$
RETURN "\u03A9 (GREEK CAPITAL LETTER OMEGA, U+03A9, Ω)",
"\U0001d6e9 (MATHEMATICAL ITALIC CAPITAL THETA, U+1D6E9, 𝛩)",
"\ud835\U0000DEF0 (MATHEMATICAL ITALIC CAPITAL OMICRON, U+1D6F0, 𝛰)",
"\u002E (FULL STOP, U+002E, .)"
$$) AS t(a agtype, b agtype, c agtype, d agtype);
-- invalid Unicode surrogate pair (need a low surrogate)
SELECT * FROM cypher('scan', $$
RETURN "\uD835"
$$) AS t(a text);
-- invalid Unicode surrogate pair (not a low surrogate)
SELECT * FROM cypher('scan', $$
RETURN "\uD835\u002E"
$$) AS t(a text);
-- invalid Unicode surrogate pair (need a high surrogate)
SELECT * FROM cypher('scan', $$
RETURN "\uDEF0"
$$) AS t(a text);
-- invalid Unicode escape value (must be less than or equal to 10FFFF)
SELECT * FROM cypher('scan', $$
RETURN "\U00110000"
$$) AS t(a text);
-- unsupported Unicode escape value ('\0' is not allowed)
SELECT * FROM cypher('scan', $$
RETURN "\u0000"
$$) AS t(a text);
-- unsupported Unicode escape value (the server encoding is not UTF8)
CREATE DATABASE contrib_regression_age_euc_kr
TEMPLATE template0
ENCODING EUC_KR
LC_COLLATE 'C' LC_CTYPE 'C';
\c contrib_regression_age_euc_kr
CREATE EXTENSION age;
LOAD 'age';
SET search_path TO ag_catalog;
SELECT create_graph('scan');
SELECT * FROM cypher('scan', $$
RETURN "\U0001D706"
$$) AS t(a text);
SELECT drop_graph('scan', true);
\c contrib_regression
DROP DATABASE contrib_regression_age_euc_kr;
LOAD 'age';
SET search_path TO ag_catalog;
-- invalid Unicode escape sequence (must be \uXXXX or \UXXXXXXXX)
SELECT * FROM cypher('scan', $$
RETURN "\UD835"
$$) AS t(a text);
SELECT * FROM cypher('scan', $$
RETURN "\uD835\uDEF"
$$) AS t(a text);
-- unterminated quoted strings
SELECT * FROM cypher('scan', $$RETURN "unterminated quoted string$$) AS t(a text);
-- recover syntax highlighting "
SELECT * FROM cypher('scan', $$RETURN 'unterminated quoted string$$) AS t(a text);
-- recover syntax highlighting '
SELECT * FROM cypher('scan', $$RETURN "escape \$$) AS t(a text);
-- recover syntax highlighting "
SELECT * FROM cypher('scan', $$RETURN "high surrogate \uD835$$) AS t(a text);
-- recover syntax highlighting "
--
-- identifier
--
-- check that they are accepted as identifier (all tests throw an error)
SELECT * FROM cypher('scan', $$
RETURN _$09A_z
$$) AS t(id text);
SELECT * FROM cypher('scan', $$
RETURN A
$$) AS t(id text);
SELECT * FROM cypher('scan', $$
RETURN z
$$) AS t(id text);
SELECT * FROM cypher('scan', $$
RETURN `$`
$$) AS t(id text);
SELECT * FROM cypher('scan', $$
RETURN `0`
$$) AS t(id text);
SELECT * FROM cypher('scan', $$
RETURN ````
$$) AS t(id text);
-- zero-length quoted identifier
SELECT * FROM cypher('scan', $$
RETURN ``
$$) AS t(a text);
SELECT * FROM cypher('scan', $$
RETURN `unterminated quoted identifier
$$) AS t(a text);
-- recover syntax highlighting `
--
-- parameter
--
-- invalid parameter names
SELECT * FROM cypher('scan', $cypher$
RETURN $$
$cypher$) AS t(a text);
SELECT * FROM cypher('scan', $$
RETURN $0
$$) AS t(a text);
SELECT drop_graph('scan', true);
|