Skip to content

test(postgresql): Confirm DELETE_ALL qualifies bare table names with … - #929

Merged
jeffjensen merged 1 commit into
mainfrom
397-postgresql-schema-confirmation
Aug 11, 2026
Merged

jeffjensen merged 1 commit into
mainfrom
397-postgresql-schema-confirmation

Conversation

@jeffjensen

@jeffjensen jeffjensen commented Aug 11, 2026

Copy link
Copy Markdown
Member

…schema

  • Reproduces the second scenario from issue 397: an IDatabaseConnection configured with a non-default schema (e.g. "bi"), given an unqualified table name, without FEATURE_QUALIFIED_TABLE_NAMES. Confirms DatabaseOperation.DELETE_ALL already qualifies the generated SQL with the connection's own schema via AbstractOperation.getQualifiedName(), independent of that feature flag.
  • Verified locally that this fails exactly as originally reported ("relation ... does not exist") when the connection has no schema configured, and succeeds once the connection is constructed with its schema - confirming the test exercises the real scenario rather than passing vacuously.
  • The report's other scenario, a schema-qualified table name failing to resolve, is the case-folding defect already fixed and covered by PostgresqlUppercaseSchemaIT (issue 656).

Refs: 397

Claude-Session: https://claude.ai/code/session_017rt6YcFdhBCwafLp6n7mcZ

Summary by Sourcery

Tests:

  • Introduce PostgresqlNonPublicSchemaDeleteAllIT to reproduce issue 397 and assert DELETE_ALL deletes rows in a schema-scoped table when using an unqualified table name with a schema-configured connection.

@jeffjensen jeffjensen linked an issue Aug 11, 2026 that may be closed by this pull request
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sourcery-ai

sourcery-ai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds a new PostgreSQL integration test that reproduces issue 397’s non-default schema scenario and verifies that DatabaseOperation.DELETE_ALL correctly qualifies unqualified table names with the connection schema, independent of FEATURE_QUALIFIED_TABLE_NAMES.

File-Level Changes

Change Details Files
Add a PostgreSQL integration test covering DELETE_ALL behavior with a non-public schema and an unqualified table name.
  • Create PostgresqlNonPublicSchemaDeleteAllIT JUnit 5 integration test class guarded by the postgresql profile system property.
  • In test setup, create and populate a dedicated schema and table, then wrap the JDBC connection in a DatabaseConnection configured with that schema.
  • Implement a test that constructs a dataset with an unqualified table name, executes DatabaseOperation.DELETE_ALL, and asserts all rows are removed via a direct SQL count query.
  • Add teardown logic to drop the test schema and close the database connection after each test.
src/test/java/org/dbunit/ext/postgresql/PostgresqlNonPublicSchemaDeleteAllIT.java

Assessment against linked issues

Issue Objective Addressed Explanation
#397 Ensure DatabaseOperation.DELETE_ALL applies the IDatabaseConnection's configured schema when executing deletes against unqualified table names in PostgreSQL, avoiding "relation does not exist" errors.
#397 Ensure DatabaseOperation.DELETE_ALL correctly handles schema-qualified table names (e.g., "BI.APP_ROLE_ALL_CHILDREN") in PostgreSQL, resolving them in the dataset and generating valid SQL regardless of case-folding. The PR only adds an integration test for the unqualified-table-name scenario. It does not modify or add tests for schema-qualified table name resolution; that behavior is stated as already covered by PostgresqlUppercaseSchemaIT from a different issue (656), not by this PR.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jeffjensen, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 628cf111-9230-4a69-bfe8-cdb82e729fe2

📥 Commits

Reviewing files that changed from the base of the PR and between 8c894e7 and fb7e2cf.

📒 Files selected for processing (1)
  • src/test/java/org/dbunit/ext/postgresql/PostgresqlNonPublicSchemaDeleteAllIT.java

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jeffjensen jeffjensen removed a link to an issue Aug 11, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider using try-with-resources for the Statement and ResultSet instances in both setup/teardown and the test to ensure they are closed reliably even if an exception occurs.
  • Instead of if (!Objects.isNull(_connection)), prefer a direct null check (_connection != null) for clarity and consistency with common Java style in the rest of the codebase.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider using try-with-resources for the `Statement` and `ResultSet` instances in both setup/teardown and the test to ensure they are closed reliably even if an exception occurs.
- Instead of `if (!Objects.isNull(_connection))`, prefer a direct null check (`_connection != null`) for clarity and consistency with common Java style in the rest of the codebase.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@jeffjensen jeffjensen linked an issue Aug 11, 2026 that may be closed by this pull request
@jeffjensen

Copy link
Copy Markdown
Member Author

Addressed both: Statement/ResultSet handling in setUp/tearDown/the test now uses try-with-resources instead of manual .close() calls, and the null check is now _connection != null (dropped the now-unused Objects import). Committed as a fixup, not pushed yet.

…schema

* Reproduces the second scenario from issue 397: an IDatabaseConnection
  configured with a non-default schema (e.g. "bi"), given an unqualified
  table name, without FEATURE_QUALIFIED_TABLE_NAMES. Confirms
  DatabaseOperation.DELETE_ALL already qualifies the generated SQL with
  the connection's own schema via AbstractOperation.getQualifiedName(),
  independent of that feature flag.
* Verified locally that this fails exactly as originally reported
  ("relation ... does not exist") when the connection has no schema
  configured, and succeeds once the connection is constructed with its
  schema - confirming the test exercises the real scenario rather than
  passing vacuously.
* The report's other scenario, a schema-qualified table name failing to
  resolve, is the case-folding defect already fixed and covered by
  PostgresqlUppercaseSchemaIT (issue 656).

Refs: 397

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rt6YcFdhBCwafLp6n7mcZ
@jeffjensen
jeffjensen force-pushed the 397-postgresql-schema-confirmation branch from 6ce3683 to fb7e2cf Compare August 11, 2026 00:48
@jeffjensen
jeffjensen merged commit 3378ef9 into main Aug 11, 2026
29 checks passed
@jeffjensen
jeffjensen deleted the 397-postgresql-schema-confirmation branch August 11, 2026 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Postgresql and schema

1 participant