feat: dbms_output as wrapper of RAISE INFO#971
feat: dbms_output as wrapper of RAISE INFO#971rophy wants to merge 4 commits intoIvorySQL:masterfrom
Conversation
- Implement DBMS_OUTPUT.PUT_LINE and PUT as wrappers for RAISE INFO - Add hello_pkg test using DBMS_OUTPUT - Basic implementation without buffering
- Update plisql_nested_subproc2.out: ERROR -> INFO for dbms_output.put_line - Update comment in plisql_nested_subproc2.sql - Add plisql_dbms_output test with Oracle API documentation - Add plisql_dbms_output to Makefile REGRESS list
WalkthroughAdds a SQL-based DBMS_OUTPUT package and registers it in contrib aggregation; introduces tests and Makefile integration; adds a sample package test and a minor test comment change. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant DBMS_OUTPUT
participant Logger as "RAISE INFO"
participant Session
Client->>DBMS_OUTPUT: put_line(text)
DBMS_OUTPUT->>Logger: RAISE INFO with text
Logger->>Session: emit output
Client->>DBMS_OUTPUT: put(text)
DBMS_OUTPUT->>Logger: RAISE INFO with text
Logger->>Session: emit output
Client->>DBMS_OUTPUT: new_line()
DBMS_OUTPUT->>Logger: RAISE INFO with newline/space
Logger->>Session: emit output
Client->>DBMS_OUTPUT: enable(size)
DBMS_OUTPUT-->>Client: no-op (enabled by default)
Client->>DBMS_OUTPUT: disable()
DBMS_OUTPUT-->>Client: no-op (still emits)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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
🧹 Nitpick comments (1)
contrib/ivorysql_ora/src/builtin_functions/dbms_output--1.0.sql (1)
1-52: Implementation is functional but minimal - document limitations clearly.The DBMS_OUTPUT implementation provides basic Oracle compatibility by wrapping RAISE INFO. Key differences from Oracle's implementation:
- No buffering:
PUT()andPUT_LINE()output immediately rather than buffering- No enable/disable: Output cannot be disabled (procedures are no-ops)
- No retrieval:
GET_LINE()andGET_LINES()are not implementedThese limitations are acceptable for an initial release and are documented in the header comments. However, ensure users are aware that:
- Code expecting buffered output behavior may see different timing of messages
- Applications that rely on enable/disable state will always see output
- Tools that retrieve output programmatically via GET_LINE/GET_LINES won't work
Consider documenting these limitations in user-facing documentation or release notes. For a future enhancement, implementing actual buffering would improve Oracle compatibility for applications that depend on it.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
src/oracle_test/regress/expected/ora_package.outis excluded by!**/*.outsrc/pl/plisql/src/expected/plisql_dbms_output.outis excluded by!**/*.outsrc/pl/plisql/src/expected/plisql_nested_subproc2.outis excluded by!**/*.out
📒 Files selected for processing (6)
contrib/ivorysql_ora/ivorysql_ora_merge_sqls(1 hunks)contrib/ivorysql_ora/src/builtin_functions/dbms_output--1.0.sql(1 hunks)src/oracle_test/regress/sql/ora_package.sql(1 hunks)src/pl/plisql/src/Makefile(1 hunks)src/pl/plisql/src/sql/plisql_dbms_output.sql(1 hunks)src/pl/plisql/src/sql/plisql_nested_subproc2.sql(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-02T10:43:25.257Z
Learnt from: syasirs
Repo: IvorySQL/IvorySQL PR: 858
File: src/Makefile.global.in:513-514
Timestamp: 2025-09-02T10:43:25.257Z
Learning: In IvorySQL Makefile.global.in, $(wildcard t/oracle/*.pl) is used instead of t/oracle/*.pl in Oracle TAP test discovery because the t/oracle directory is optional and may not exist in most builds. The wildcard function safely returns empty string when the directory is missing, preventing shell expansion errors.
Applied to files:
src/pl/plisql/src/Makefile
🔇 Additional comments (4)
src/pl/plisql/src/sql/plisql_nested_subproc2.sql (1)
3617-3617: LGTM! Test marker updated to reflect new DBMS_OUTPUT functionality.The comment change appropriately documents that this section now tests DBMS_OUTPUT rather than raising an error about its absence.
contrib/ivorysql_ora/ivorysql_ora_merge_sqls (1)
3-3: LGTM! Module registration is correct.The new
dbms_outputmodule is properly registered in the build system's module aggregation list.src/pl/plisql/src/Makefile (1)
59-60: LGTM! Test module properly integrated.The new
plisql_dbms_outputtest is correctly added to the REGRESS suite with proper formatting and line continuation.src/oracle_test/regress/sql/ora_package.sql (1)
6097-6134: LGTM! Good test coverage for package initialization and DBMS_OUTPUT integration.This test case effectively demonstrates:
- DBMS_OUTPUT.PUT_LINE usage within package procedures
- Package initialization block behavior (should run once per session)
- Proper package creation and cleanup
The two consecutive calls to
say_hello()will verify that the initialization block (hello_pkg loaded) only executes on the first package reference, which is correct Oracle behavior.
| -- IvorySQL Current Implementation Status: | ||
| -- ✓ PUT_LINE(text) - Fully working (uses RAISE INFO) | ||
| -- ✗ PUT(text) - Syntax error | ||
| -- ✗ NEW_LINE - Syntax error | ||
| -- ✗ ENABLE(buffer_size) - Syntax error | ||
| -- ✗ DISABLE - Syntax error | ||
| -- ✗ GET_LINE(line, status) - Not implemented | ||
| -- ✗ GET_LINES(lines, numlines) - Not implemented | ||
| -- |
There was a problem hiding this comment.
Incorrect implementation status documentation.
The comments indicate that PUT, NEW_LINE, ENABLE, and DISABLE have "syntax errors", but the actual implementation in contrib/ivorysql_ora/src/builtin_functions/dbms_output--1.0.sql shows all these procedures are properly defined and should work:
PUT(text)- Implemented (lines 29-33)NEW_LINE- Implemented (lines 35-38)ENABLE(buffer_size)- Implemented as no-op (lines 41-45)DISABLE- Implemented as no-op (lines 47-51)
Update the implementation status to reflect the actual state:
-- IvorySQL Current Implementation Status:
-- ✓ PUT_LINE(text) - Fully working (uses RAISE INFO)
--- ✗ PUT(text) - Syntax error
--- ✗ NEW_LINE - Syntax error
--- ✗ ENABLE(buffer_size) - Syntax error
--- ✗ DISABLE - Syntax error
+-- ✓ PUT(text) - Working (no buffering, outputs immediately)
+-- ✓ NEW_LINE - Working (outputs space character)
+-- ✓ ENABLE(buffer_size) - Working (no-op, output always enabled)
+-- ✓ DISABLE - Working (no-op, cannot disable output)
-- ✗ GET_LINE(line, status) - Not implemented
-- ✗ GET_LINES(lines, numlines) - Not implemented🤖 Prompt for AI Agents
In src/pl/plisql/src/sql/plisql_dbms_output.sql around lines 134 to 142, the
status comment incorrectly marks PUT, NEW_LINE, ENABLE, and DISABLE as "syntax
error" while the contrib implementation defines them; update the comment block
to reflect that PUT(text), NEW_LINE, ENABLE(buffer_size) and DISABLE are
implemented (ENABLE/DISABLE as no-ops) and adjust the checklist to mark them as
working or implemented and remove the "syntax error" labels so the documentation
matches the actual contrib source.
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check the current implementation status documentation in the test file
cat src/pl/plisql/src/sql/plisql_dbms_output.sql | tail -20
Length of output: 1093
@rophy Thanks for fixing this! The documentation now accurately reflects the implementation status. I appreciate that you identified the parser limitation with no-arg procedure calls (NEW_LINE and DISABLE) and documented it clearly. This is helpful context for users who might encounter those syntax errors.
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
There was a problem hiding this comment.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
- Split combined tests into individual test cases per method - Update implementation status documentation based on test results - PUT_LINE, PUT, ENABLE work correctly - NEW_LINE, DISABLE fail (no-arg procedure parser limitation)
Hi rophy, Quick tip: You can manually run the regression test by executing the following command in the directory: |
|
sure, will follow up in a day or two |
~/IvorySQL/src/pl/plisql$ make oracle-check
make -C ../../../src/backend generated-headers
make[1]: Entering directory '/home/ivorysql/IvorySQL/src/backend'
......
# +++ ora regress check in src/pl/plisql/src +++
# initializing database system by copying initdb template
# using temp instance on port 65313 with PID 42703
ok 1 - plisql_array 15 ms
ok 2 - plisql_call 30 ms
ok 3 - plisql_control 22 ms
ok 4 - plisql_copy 10 ms
ok 5 - plisql_domain 21 ms
ok 6 - plisql_record 64 ms
ok 7 - plisql_cache 11 ms
ok 8 - plisql_simple 16 ms
ok 9 - plisql_transaction 48 ms
ok 10 - plisql_trap 1044 ms
ok 11 - plisql_trigger 10 ms
ok 12 - plisql_varprops 11 ms
ok 13 - plisql_nested_subproc 14953 ms
ok 14 - plisql_nested_subproc2 15028 ms
ok 15 - plisql_out_parameter 59 ms
ok 16 - plisql_type_rowtype 548 ms
ok 17 - plisql_dbms_output 11 ms
1..17
# All 17 tests passed.
make[1]: Leaving directory '/home/ivorysql/IvorySQL/src/pl/plisql/src' |
|
Hi, Rophy,thanks for your contribution to IvorySQL! |
|
Is aliasing to RAISE INFO good enough? If that is good enough, I can help to fix those methods such as ENABLE, DISABLE, GET_LINE as no-op. Otherwise I imagine we will need some buffering mechanism to properly mimic dbms_output |
|
Hi, Rophy, we expect to be compatible with Oracle as possible as we can, so it would be good to implement buffer mechanism and other procedures as well. |
|
That's fair. Feel free to drop this pr. |
|
OK, I'll close this PR. Thanks for your contribution to IvorySQl! |
Current version only implements
dbms_output.put_line()since that's the most common method in legacy oracle packages.I hope the commit messages are self-explanary.
Will try implement more methods once I see actual usages.
Summary by CodeRabbit
New Features
Tests
Style