|
| 1 | +-- |
| 2 | +-- Test Oracle-compatible identifier syntax |
| 3 | +-- Issue #1002: Support # character in unquoted identifiers |
| 4 | +-- |
| 5 | +-- Test # in column names |
| 6 | +CREATE TABLE test_hash_ident ( |
| 7 | + statistic# INT, |
| 8 | + col#1 INT, |
| 9 | + my#column INT |
| 10 | +); |
| 11 | +INSERT INTO test_hash_ident VALUES (1, 2, 3); |
| 12 | +SELECT statistic#, col#1, my#column FROM test_hash_ident; |
| 13 | + statistic# | col#1 | my#column |
| 14 | +------------+-------+----------- |
| 15 | + 1 | 2 | 3 |
| 16 | +(1 row) |
| 17 | + |
| 18 | +-- Test # in table names |
| 19 | +CREATE TABLE test#table (id INT); |
| 20 | +INSERT INTO test#table VALUES (100); |
| 21 | +SELECT * FROM test#table; |
| 22 | + id |
| 23 | +----- |
| 24 | + 100 |
| 25 | +(1 row) |
| 26 | + |
| 27 | +DROP TABLE test#table; |
| 28 | +-- Test $ in identifiers (already supported, verify no regression) |
| 29 | +CREATE TABLE test$table (col$1 INT); |
| 30 | +INSERT INTO test$table VALUES (200); |
| 31 | +SELECT col$1 FROM test$table; |
| 32 | + col$1 |
| 33 | +------- |
| 34 | + 200 |
| 35 | +(1 row) |
| 36 | + |
| 37 | +DROP TABLE test$table; |
| 38 | +-- Test mixed special characters |
| 39 | +CREATE TABLE test_mixed ( |
| 40 | + col_1 INT, |
| 41 | + col$2 INT, |
| 42 | + col#3 INT, |
| 43 | + col_$#4 INT |
| 44 | +); |
| 45 | +INSERT INTO test_mixed VALUES (1, 2, 3, 4); |
| 46 | +SELECT col_1, col$2, col#3, col_$#4 FROM test_mixed; |
| 47 | + col_1 | col$2 | col#3 | col_$#4 |
| 48 | +-------+-------+-------+--------- |
| 49 | + 1 | 2 | 3 | 4 |
| 50 | +(1 row) |
| 51 | + |
| 52 | +DROP TABLE test_mixed; |
| 53 | +-- Verify # XOR operator still works (both with and without spaces) |
| 54 | +SELECT 5 # 3 AS xor_result; |
| 55 | + xor_result |
| 56 | +------------ |
| 57 | + 6 |
| 58 | +(1 row) |
| 59 | + |
| 60 | +SELECT 5#3 AS xor_no_spaces; |
| 61 | + xor_no_spaces |
| 62 | +--------------- |
| 63 | + 6 |
| 64 | +(1 row) |
| 65 | + |
| 66 | +SELECT B'1010' # B'1100' AS bit_xor; |
| 67 | + bit_xor |
| 68 | +--------- |
| 69 | + 0110 |
| 70 | +(1 row) |
| 71 | + |
| 72 | +-- Verify JSON path operators work without spaces (issue was potential conflict) |
| 73 | +SELECT '{"a":1}'::json#>'{a}' AS json_path_no_space; |
| 74 | + json_path_no_space |
| 75 | +-------------------- |
| 76 | + 1 |
| 77 | +(1 row) |
| 78 | + |
| 79 | +SELECT '{"b":2}'::jsonb#>>'{b}' AS jsonb_path_no_space; |
| 80 | + jsonb_path_no_space |
| 81 | +--------------------- |
| 82 | + 2 |
| 83 | +(1 row) |
| 84 | + |
| 85 | +SELECT '{"a":1,"b":2}'::jsonb#-'{a}' AS jsonb_delete_no_space; |
| 86 | + jsonb_delete_no_space |
| 87 | +----------------------- |
| 88 | + {"b": 2} |
| 89 | +(1 row) |
| 90 | + |
| 91 | +-- Clean up |
| 92 | +DROP TABLE test_hash_ident; |
0 commit comments