Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds Oracle-compatible Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
For issue 1094: |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
contrib/ivorysql_ora/sql/ora_raw_long.sql (1)
47-55: Consider adding 1–2 edge assertions to strengthenrawtohexcoverage.Current tests are solid; adding a lowercase-hex input and an escaped-text input would better guard output normalization and text conversion behavior.
♻️ Suggested test additions
-- rawtohex SELECT sys.rawtohex('\xDEADBEEF'::bytea); +SELECT sys.rawtohex('\xdeadbeef'::bytea); SELECT sys.rawtohex('\xFF'::raw); SELECT sys.rawtohex('hello'::text); +SELECT sys.rawtohex(E'a\\b'::text); SELECT sys.rawtohex('hello'::varchar2); SELECT sys.rawtohex(sys.hextoraw('DEADBEEF')); SELECT sys.rawtohex(NULL) IS NULL; SELECT sys.rawtohex('') IS NULL; SELECT sys.rawtohex('\x'::bytea) IS NULL;As per coding guidelines,
**/sql/*.sql: “Test SQL files. Ensure comprehensive coverage of features.”🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@contrib/ivorysql_ora/sql/ora_raw_long.sql` around lines 47 - 55, Tests for rawtohex lack a lowercase hex input and an escaped-text input to validate normalization and text conversion; add assertions invoking sys.rawtohex with a lowercase hex via sys.hextoraw('deadbeef') and with an escaped textual bytea like sys.rawtohex(E'\\xDEADBEEF'::bytea) (or another escaped-text variant) and assert expected normalized uppercase hex results (and NULL behavior where applicable) to the existing rawtohex tests alongside the existing sys.hextoraw and bytea/text cases.contrib/ivorysql_ora/src/builtin_functions/builtin_functions--1.0.sql (1)
964-970: Reduce overload drift by delegatingtextto thebyteaoverload.Both overloads implement the same null/empty logic; delegating keeps behavior centralized and easier to maintain.
♻️ Suggested refactor
CREATE OR REPLACE FUNCTION sys.rawtohex(text) RETURNS varchar2 -AS $$ SELECT CASE WHEN pg_catalog.octet_length($1) > 0 THEN upper(pg_catalog.encode($1::bytea, 'hex'))::varchar2 END; $$ +AS $$ SELECT sys.rawtohex($1::bytea); $$ LANGUAGE SQL PARALLEL SAFE STRICT IMMUTABLE;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@contrib/ivorysql_ora/src/builtin_functions/builtin_functions--1.0.sql` around lines 964 - 970, Replace the duplicated logic in sys.rawtohex(text) by delegating to the existing bytea overload: change the function body to simply SELECT sys.rawtohex($1::bytea); so the text overload casts its input to bytea and reuses sys.rawtohex(bytea) (keeping the same function signature, LANGUAGE SQL, PARALLEL SAFE, STRICT, IMMUTABLE attributes) to centralize null/empty handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@contrib/ivorysql_ora/sql/ora_raw_long.sql`:
- Around line 47-55: Tests for rawtohex lack a lowercase hex input and an
escaped-text input to validate normalization and text conversion; add assertions
invoking sys.rawtohex with a lowercase hex via sys.hextoraw('deadbeef') and with
an escaped textual bytea like sys.rawtohex(E'\\xDEADBEEF'::bytea) (or another
escaped-text variant) and assert expected normalized uppercase hex results (and
NULL behavior where applicable) to the existing rawtohex tests alongside the
existing sys.hextoraw and bytea/text cases.
In `@contrib/ivorysql_ora/src/builtin_functions/builtin_functions--1.0.sql`:
- Around line 964-970: Replace the duplicated logic in sys.rawtohex(text) by
delegating to the existing bytea overload: change the function body to simply
SELECT sys.rawtohex($1::bytea); so the text overload casts its input to bytea
and reuses sys.rawtohex(bytea) (keeping the same function signature, LANGUAGE
SQL, PARALLEL SAFE, STRICT, IMMUTABLE attributes) to centralize null/empty
handling.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1958b8fa-d05c-48fa-80ec-6d0d3085b975
📒 Files selected for processing (3)
contrib/ivorysql_ora/expected/ora_raw_long.outcontrib/ivorysql_ora/sql/ora_raw_long.sqlcontrib/ivorysql_ora/src/builtin_functions/builtin_functions--1.0.sql
Summary by CodeRabbit
New Features
Tests