Repository navigation
Add EXTRACT as a keyword and function in Oracle parser - #947
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (2)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughThe Oracle parser grammar has been extended to recognize and parse the EXTRACT keyword as a built-in function. Two files were modified: the grammar rules now include EXTRACT with function-call syntax, and the keyword list declares EXTRACT with appropriate classifications for usage in non-keyword contexts. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/backend/oracle_parser/ora_gram.y(4 hunks)src/include/oracle_parser/ora_kwlist.h(4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: pg_regression (ubuntu-latest)
- GitHub Check: oracle_regression (ubuntu-latest)
- GitHub Check: meson_build (ubuntu-latest)
- GitHub Check: contrib_regression
- GitHub Check: build (ubuntu-latest)
- GitHub Check: oracle_pg_regression (ubuntu-latest)
🔇 Additional comments (4)
src/include/oracle_parser/ora_kwlist.h (1)
203-203: Code changes are correct—no issues found.The EXTRACT keyword addition complements the existing PGEXTRACT keyword, not conflicts with it. Both keywords are intentionally supported in the Oracle parser grammar as synonymous variants: each parses an
extract_listand invokes the sameSystemFuncName("extract")system function (src/backend/oracle_parser/ora_gram.y lines 18007, 18014). This dual support allows both standard SQLEXTRACT()syntax and Oracle-compatiblePGEXTRACT()syntax to work.src/backend/oracle_parser/ora_gram.y (3)
20870-20874: Bare label inclusion is fine; keep lists alphabetized.EXTRACT appears in the E-section in bare_label_keyword; ordering looks correct. No further action.
18014-18020: Code structure verified as correct; manual build verification required for parser conflicts.The EXTRACT grammar arm (lines 18014–18019) is confirmed to mirror PGEXTRACT identically:
- Both use
SystemFuncName("extract")- Both reuse
extract_listparameter- Both apply
COERCE_SQL_SYNTAXconsistentlyHowever, bison is unavailable in this environment, preventing automated conflict detection. You must run
bison -v src/backend/oracle_parser/ora_gram.ylocally and verify thatora_gram.outputcontains no new shift/reduce or reduce/reduce conflicts before merging.
20509-20515: Verification complete: EXTRACT mapping already exists in kwlist.h with correct configuration.The review comment's concern is already satisfied. The kwlist.h file contains the entry:
PG_KEYWORD("extract", EXTRACT, COL_NAME_KEYWORD, BARE_LABEL)with the correct token (EXTRACT), keyword category (COL_NAME_KEYWORD), and bare label status (BARE_LABEL). The scanner will properly emit the EXTRACT token as intended. No further action needed.
| EXTRACT PGEXTRACT PLACING PLAN PLANS POLICY | ||
| POSITION PRECEDING PRECISION PRESERVE PREPARE PREPARED PRIMARY |
There was a problem hiding this comment.
Fix token ordering: EXTRACT placed in the P-block breaks “alphabetical order” contract.
Move EXTRACT to the E-block (near EXTERNAL) and keep PGEXTRACT in the P-block. This preserves the documented ordering and avoids future merge pain.
Apply:
- PARALLEL PARAMETER PARSER PARTIAL PARTITION PASSING PASSWORD PATH
- EXTRACT PGEXTRACT PLACING PLAN PLANS POLICY
+ PARALLEL PARAMETER PARSER PARTIAL PARTITION PASSING PASSWORD PATH
+ PGEXTRACT PLACING PLAN PLANS POLICYand in the E-block (around the other EX* tokens):
- EXTENSION EXTERNAL
+ EXTENSION EXTERNAL EXTRACTCommittable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/backend/oracle_parser/ora_gram.y around lines 783-784, the token list
places EXTRACT in the P-block which breaks the alphabetical ordering; move
EXTRACT out of the P-block (leave PGEXTRACT in P-block) and insert EXTRACT into
the E-block near the other EX* tokens (e.g., next to EXTERNAL) so both blocks
remain alphabetically ordered and future merges won't reorder tokens.
Summary by CodeRabbit