Skip to content

Conversation

@KodaiD
Copy link
Contributor

@KodaiD KodaiD commented Jul 18, 2025

Description

This PR fixes an issue where JdbcAdmin fails to drop an index created by another Oracle user due to the lack of schema name specification.

In Oracle, users must specify the schema name when dropping an index that was created by another user. Also, when creating an index in a specific schema, the schema name must be specified in the index name. The current implementation of JdbcAdmin does not do this, leading to ORA-01418 (specified index does not exist) when attempting to drop the index. As a result, we cannot use JdbcAdmin with multiple Oracle users now.

To fix the issue, the specification of the schema name when creating or dropping an index in Oracle is added in this PR.

Related issues and/or PRs

N/A

Changes made

  • Prepare the feature to generate a CREATE INDEX SQL statement in RdbEngineStrategy interface side to absorb the differences across different Databases.
  • Specify the schema name when creating or dropping an index in Oracle engine.

Checklist

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • I have considered whether similar issues could occur in other products, components, or modules if this PR is for bug fixes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

The specification of Oracle I mentioned in the description is described below:

Specify the schema containing the index. If you omit schema, then Oracle Database assumes the index is in your own schema.

https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/CREATE-INDEX.html

Specify the schema to contain the index. If you omit schema, then Oracle Database creates the index in your own schema.

https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/CREATE-INDEX.html

Release notes

N/A

@KodaiD KodaiD self-assigned this Jul 18, 2025
@KodaiD KodaiD added the bugfix label Jul 18, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @KodaiD, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a long-standing problem in JdbcAdmin related to Oracle's index management, particularly in multi-user environments. By refactoring the index creation logic to be database-aware and ensuring schema qualification for Oracle indexes, the system can now correctly create and drop indexes regardless of the creating user. This change enhances the robustness and compatibility of JdbcAdmin with Oracle databases.

Highlights

  • Oracle Index Management Fix: I've addressed an issue in JdbcAdmin where index operations on Oracle databases would fail when indexes were created by different users. The fix involves explicitly including the schema name in CREATE INDEX and DROP INDEX statements for Oracle, resolving ORA-01418 errors.
  • RDBMS Abstraction Layer Enhancement: To facilitate database-specific index creation logic, I've introduced a new abstract method, createIndexSql, to the RdbEngineStrategy interface. This centralizes the generation of CREATE INDEX statements, allowing each RDBMS implementation to define its specific SQL syntax.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors index creation to be database-specific by introducing createIndexSql in the RdbEngineStrategy interface. The fix for Oracle is incomplete, as the dropIndexSql method is not updated to include the schema. A test case for Oracle in JdbcAdminTest.java has a typo that will cause it to fail.

@KodaiD KodaiD force-pushed the fix-oracle-engine-with-multiple-users branch from 1cb71d7 to b38a05f Compare July 18, 2025 01:39
@KodaiD KodaiD changed the title Fix JdbcAdmin to support multiple Oracle users for index operations Fix Oracle engine to support multiple Oracle users for index operations Jul 18, 2025
@KodaiD KodaiD marked this pull request as ready for review July 18, 2025 02:36
@KodaiD KodaiD requested review from a team, Torch3333, brfrn169, feeblefakie and komamitsu and removed request for a team July 18, 2025 02:36
Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for what Mitsu pointed out.
Thank you!

@KodaiD KodaiD requested a review from komamitsu July 18, 2025 04:49
Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

Copy link
Contributor

@komamitsu komamitsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

Copy link
Collaborator

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants