Skip to content

Drop CREATE FOREIGN TABLE with a foreign data warning - #106

Merged
LucaCappelletti94 merged 1 commit into
mainfrom
upstream/follow-sqlparser-create-foreign-table
Sep 26, 2026
Merged

LucaCappelletti94 merged 1 commit into
mainfrom
upstream/follow-sqlparser-create-foreign-table

Conversation

@LucaCappelletti94

@LucaCappelletti94 LucaCappelletti94 commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

sqlparser main added Statement::CreateForeignTable in apache/datafusion-sqlparser-rs#2515. The statement translator matches Statement with no wildcard arm so that every new variant gets classified on purpose, and pg2sqlite stopped compiling against sqlparser main as a result.

A foreign table reads its rows through a server and a wrapper that SQLite has no counterpart for, so CREATE FOREIGN TABLE joins CREATE SERVER and the connector and secret statements. It emits nothing and reports a lossy drop warning with the shared foreign data reason.

Summary by Sourcery

Classify unsupported CREATE FOREIGN TABLE statements as lossy drops with foreign-data warnings.

Bug Fixes:

  • Handle CREATE FOREIGN TABLE statements so they no longer prevent compilation against newer sqlparser versions.

Enhancements:

  • Drop unsupported CREATE FOREIGN TABLE statements with the standard lossy foreign-data warning.

Tests:

  • Add coverage verifying that CREATE FOREIGN TABLE is classified as a warned, lossy drop.

@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 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.

Sorry @LucaCappelletti94, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 22 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository: LucaCappelletti94/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 9757f356-9fb4-4d5e-ab0f-5049b9d62667


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.

@sourcery-ai

sourcery-ai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The translator now explicitly handles sqlparser’s CreateForeignTable variant, dropping it because SQLite has no foreign-server/wrapper equivalent while emitting the shared lossy foreign-data warning. Tests cover both classification and warning ordering for CREATE FOREIGN TABLE.

Flow diagram for CREATE FOREIGN TABLE translation

flowchart LR
    A[CREATE FOREIGN TABLE] --> B[Statement translator]
    B --> C[drop_with_warning]
    C --> D[Emit no SQLite statement]
    C --> E[REASON_FOREIGN_DATA]
Loading

File-Level Changes

Change Details Files
Classify CREATE FOREIGN TABLE as unsupported foreign-data SQL and drop it with a lossy warning.
  • Add an explicit translator match arm using the shared foreign-data warning reason.
  • Preserve the statement name in the emitted warning.
src/impls/translator_impls/statement.rs
Add regression coverage ensuring foreign-table statements are never silently dropped.
  • Include CREATE FOREIGN TABLE in the no-silent-drop cases.
  • Verify it emits a lossy-drop warning alongside the prerequisite CREATE SERVER warning.
tests/test_no_statement_is_silently_dropped.rs
tests/test_translation_warnings.rs

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

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Sep 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.79%. Comparing base (b1684d6) to head (c4a6ad4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #106   +/-   ##
=======================================
  Coverage   92.79%   92.79%           
=======================================
  Files          66       66           
  Lines       28263    28264    +1     
=======================================
+ Hits        26226    26227    +1     
  Misses       2037     2037           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LucaCappelletti94
LucaCappelletti94 merged commit 8d05c61 into main Sep 26, 2026
22 checks passed
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.

1 participant