Debian Codegraph @

autotests/input/test.sql_postgres

raw
1 -- PostgreSQL doesn't use # as comment
2 select jsoncol #> array['p1', 'p2']
3 from some_table
4 where col#-'{1, a}' @? '$.b ? (@ > 0)';
5
6 SELECT
7
8 'Single quoted string' AS test01,
9 'Backslashes in single-quoted strings are interpreted literally and get no highlighting: \ ' AS test02,
10 'The single-quote character can be escaped by using two of them: '' This is highlighted.' AS test03,
11 'Line breaks
12 are allowed' AS test04,
13
14 E'Escape strings are introduced with an uppercase E…' AS test11,
15 e'or a lowercase e.' AS test12,
16 E'Line breaks
17 are allowed' AS test13,
18 E'The single-quote character can be escaped by using two of them: '' This is highlighted.' AS test14,
19 E'They can have escapes like \t or three-digit octal \011 or two-digit hexadecimal \x09.' AS test15,
20 E'Also the escape character itself and the single-quote can be escaped: \\ and \' are highlighted.' AS test16,
21 E'Non-defined combinations: Example: \y is highlighted because it’s treated as escaped characters and substituted by “y”. Even before a line break\
22 this is possible.' AS test17,
23 E'Higher Unicode code points: Hex: Four-digit \u1234 and eight-digit \U00001234' AS test18,
24 E'These escapes with “u” and “U” are the only one that are not error tolerant: \u123 and \u123 are highlighted as errors.' AS test19,
25
26 U&'Unicode escape strings are introduced with an uppercase U…' AS test21,
27 u&'or a lowercase u.' AS test22,
28 U&'The single-quote character can be escaped by using two of them: '' This is highlighted.' AS test23,
29 U&'Types of escape: \0061 and \+000061 and \\' AS test24,
30 U&'All other usages of \ are errors, including \' test25,
31 U&'Line breaks
32 are allowed' AS test26,
33
34 U&'User-defined escape characters can be used instead of \ by specifying' UESCAPE 'w' AS test31,
35 U&'Here, \ behaves as normal character. Escape sequences: w0061 and w+000061 and ww' UESCAPE 'w' AS test32,
36 U&'Also work correctly for escape characters that have a special meaning in Regular Expressions: .0061 .+000061 and ..' UESCAPE '.' AS test33,
37
38 0 AS U&"Unicode escape identifiers are introduces with an uppercase U…",
39 0 AS u&"or a lowercase u.",
40 0 AS U&"The double-quote character can be escaped by using two of them: "" This is highlighted.",
41 0 AS U&"Types of escape: \0061 and \+000061 and \\",
42 0 AS U&"All other usages of \ are errors, including \",
43 0 AS U&"Line breaks
44 are allowed"
45
46 power(2, 3) AS test31, -- PostgreSQL Build-in functions (like “power”) are highlighted when followed by an opening parenthesis…
47 power AS test32, 0 AS power, -- …but not highlighted if used as identifier.
48 ST_PointOnSurface(way) AS test33, -- PostGIS functions are highlighted as extensions.
49
50 -- User-defined functions get no special highlighting:
51 testpower(2, 3) AS test34,
52
53 foo AS bar
54
55 FROM mytable;