Skip to content

Commit 6ea3c01

Browse files
committed
fix: address PR review comments for IvorySQL#1002
- Update comment in oracle_quote_identifier() to mention # and $ - Add test case for #- JSON delete operator without spaces
1 parent 8ed1a65 commit 6ea3c01

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/backend/oracle_parser/liboracle_parser.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,8 +1272,9 @@ oracle_quote_identifier(const char *ident)
12721272
{
12731273
/*
12741274
* Can avoid quoting if ident starts with a lowercase letter or underscore
1275-
* and contains only lowercase letters, digits, and underscores, *and* is
1276-
* not any SQL keyword. Otherwise, supply quotes.
1275+
* and contains only lowercase letters, digits, underscores, and the
1276+
* special characters # and $ (for Oracle compatibility), *and* is not any
1277+
* SQL keyword. Otherwise, supply quotes.
12771278
*/
12781279
int nquotes = 0;
12791280
bool safe;

src/oracle_test/regress/expected/ora_identifiers.out

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,11 @@ SELECT '{"b":2}'::jsonb#>>'{b}' AS jsonb_path_no_space;
8282
2
8383
(1 row)
8484

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+
8591
-- Clean up
8692
DROP TABLE test_hash_ident;

src/oracle_test/regress/sql/ora_identifiers.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ SELECT B'1010' # B'1100' AS bit_xor;
4444
-- Verify JSON path operators work without spaces (issue was potential conflict)
4545
SELECT '{"a":1}'::json#>'{a}' AS json_path_no_space;
4646
SELECT '{"b":2}'::jsonb#>>'{b}' AS jsonb_path_no_space;
47+
SELECT '{"a":1,"b":2}'::jsonb#-'{a}' AS jsonb_delete_no_space;
4748

4849
-- Clean up
4950
DROP TABLE test_hash_ident;

0 commit comments

Comments
 (0)