Add SYS.USER_CONS_COLUMNS view and test case#1289
Add SYS.USER_CONS_COLUMNS view and test case#12893296442201 wants to merge 3 commits intoIvorySQL:masterfrom
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 (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds a new Oracle-compatible view Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 SQLFluff (4.1.0)contrib/ivorysql_ora/sql/ora_sysview.sqlUser Error: Specified path does not exist. Check it/they exist(s): contrib/ivorysql_ora/sql/ora_sysview.sql. contrib/ivorysql_ora/src/sysview/sysview--1.0.sqlUser Error: Specified path does not exist. Check it/they exist(s): contrib/ivorysql_ora/src/sysview/sysview--1.0.sql. 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: 2
🧹 Nitpick comments (1)
contrib/ivorysql_ora/sql/ora_sysview.sql (1)
94-106: Broaden this test to cover multi-column constraint mappings.This smoke test validates the happy path, but it does not exercise the
conkeyexpansion behavior for multi-column constraints (or non-PK constraints beyond NOT NULL). Add at least one composite constraint case and assert one row per constrained column.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_sysview.sql` around lines 94 - 106, The test only covers a single-column NOT NULL constraint; extend TEST_USER_CONS_COLUMNS to include at least one composite constraint (e.g., CONSTRAINT <name> UNIQUE (col1, col2) or a composite PRIMARY KEY) and corresponding additional columns so that conkey expansion is exercised; then run the SELECT from SYS.USER_CONS_COLUMNS and assert that it returns one row per constrained column (i.e., one row for each column in the composite constraint) by ordering on CONSTRAINT_NAME, COLUMN_NAME as before; update the CREATE TABLE and any INSERT/cleanup statements to add the new columns/constraint and ensure the DROP TABLE remains at the end.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@contrib/ivorysql_ora/expected/ora_sysview.out`:
- Around line 188-190: Reorder the three expected rows so they match the query's
ORDER BY CONSTRAINT_NAME, COLUMN_NAME: place both
TEST_USER_CONS_COLUMNS_NOT_NULL rows before TEST_USER_CONS_COLUMNS_PKEY, and
within TEST_USER_CONS_COLUMNS_NOT_NULL sort by COLUMN_NAME (ID then NAME) so the
final sequence is NOT_NULL/ID, NOT_NULL/NAME, then PKEY/ID; update the three
lines in ora_sysview.out accordingly.
In `@contrib/ivorysql_ora/src/sysview/sysview--1.0.sql`:
- Around line 1277-1298: Add an explicit permission grant so non-owner sessions
can query the new view: after the CREATE OR REPLACE VIEW SYS.USER_CONS_COLUMNS
(the view built from PG_CONSTRAINT / PG_CLASS / PG_ATTRIBUTE), issue a GRANT
SELECT on SYS.USER_CONS_COLUMNS to the appropriate role (e.g., PUBLIC or the
intended user role) so the view is readable by non-owners.
---
Nitpick comments:
In `@contrib/ivorysql_ora/sql/ora_sysview.sql`:
- Around line 94-106: The test only covers a single-column NOT NULL constraint;
extend TEST_USER_CONS_COLUMNS to include at least one composite constraint
(e.g., CONSTRAINT <name> UNIQUE (col1, col2) or a composite PRIMARY KEY) and
corresponding additional columns so that conkey expansion is exercised; then run
the SELECT from SYS.USER_CONS_COLUMNS and assert that it returns one row per
constrained column (i.e., one row for each column in the composite constraint)
by ordering on CONSTRAINT_NAME, COLUMN_NAME as before; update the CREATE TABLE
and any INSERT/cleanup statements to add the new columns/constraint and ensure
the DROP TABLE remains at the end.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: bc84a642-7239-4a27-ad2d-1aa97c805b97
📒 Files selected for processing (3)
contrib/ivorysql_ora/expected/ora_sysview.outcontrib/ivorysql_ora/sql/ora_sysview.sqlcontrib/ivorysql_ora/src/sysview/sysview--1.0.sql
|
what's the relationship between #1270 and this one? |
| SYS.ORA_CASE_TRANS(PG_GET_USERBYID(C.RELOWNER)::VARCHAR2)::VARCHAR2(128) AS OWNER, | ||
| SYS.ORA_CASE_TRANS(C.RELNAME::VARCHAR2)::VARCHAR2(128) AS TABLE_NAME, | ||
| SYS.ORA_CASE_TRANS(CON.CONNAME::VARCHAR2)::VARCHAR2(128) AS CONSTRAINT_NAME, | ||
| SYS.ORA_CASE_TRANS(ATT.ATTNAME::VARCHAR2)::VARCHAR2(128) AS COLUMN_NAME |
|
please rework per the comments from coderabbitai and me. |
|
For issue 1010: |
Summary by CodeRabbit
New Features
Tests