You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "CuriousLinYu (via GitHub)" <gi...@apache.org> on 2026/08/20 02:21:10 UTC

[PR] Support foreign table syntax for openGauss [shardingsphere]

CuriousLinYu opened a new pull request, #39525:
URL: https://github.com/apache/shardingsphere/pull/39525

   Fixes #25104.
   
   ## Changes
   
   - openGauss: add `createForeignTable` and `dropForeignTable` rules to `execute` in `OpenGaussStatementParser.g4`
   - openGauss: implement `visitCreateForeignTable` and `visitDropForeignTable` in `OpenGaussDDLStatementVisitor`
   - Reuse the existing PostgreSQL statement classes (`PostgreSQLCreateForeignTableStatement` / `PostgreSQLDropForeignTableStatement`)
   - Enable existing parser test cases for openGauss (`create-foreign-table.xml` and `drop-foreign-table.xml`)
   
   ## Verification
   
   - `mvn -pl parser/sql/engine/dialect/opengauss -am compile -DskipTests` passes
   - `mvn -pl test/it/parser test -Dtest=InternalOpenGaussParserIT` — 947 cases passed (928 + 19 new foreign table cases for openGauss)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Support foreign table syntax for openGauss [shardingsphere]

Posted by "CuriousLinYu (via GitHub)" <gi...@apache.org>.
CuriousLinYu commented on PR #39525:
URL: https://github.com/apache/shardingsphere/pull/39525#issuecomment-5519764900

   @terrymanu thanks for the thorough review — the P1 is right, and it's now addressed in `2bbead23`.
   
   **What changed**
   
   - Added a third alternative to `createForeignTableClauses` in `imports/opengauss/DDLStatement.g4`:
     `ifNotExists? qualifiedName LP_ tableElementList? RP_ createGenericOptions?`
     This mirrors the `ENABLE_MOT` branch of openGauss `gram.y` exactly (no `INHERITS`, no `SERVER`, `create_generic_options` optional), rather than simply making `SERVER` optional on the existing branch — that way we don't accept forms openGauss itself rejects.
   - PostgreSQL's grammar is untouched: PostgreSQL `gram.y` has no no-`SERVER` alternative, so the new IT cases are `db-types="openGauss"` only.
   
   **Alignment on the contract**
   
   Agreed that openGauss accepts no-`SERVER`. The evidence was already in #25104: @congzhou2603 tested it against openGauss 5.0.0 (works, screenshot attached there), and @strongduanmu confirmed from the `gram.y` source that "the server name is optional, but it is not shown in the openGauss documentation". The `mot_server` default comes from the `ENABLE_MOT` branch (`servername = pstrdup("mot_server")`). So the no-`SERVER` form is part of the openGauss contract even though the docs list `SERVER` as required — your test-plan note about `SERVER` being required describes the current ShardingSphere grammar, which is exactly the limitation this PR now lifts.
   
   **Tests**
   
   - Added the original reproducer from #25103 (`CREATE FOREIGN TABLE t_order (user_id int, order_name varchar(30));`) plus an `OPTIONS`-only variant, both `openGauss`-only, in `create-foreign-table.xml` (supported + case).
   - `InternalOpenGaussParserIT`: **949 cases, 0 failures** (947 before, +2 new).
   
   Please re-review when you have a moment.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Support foreign table syntax for openGauss [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu merged PR #39525:
URL: https://github.com/apache/shardingsphere/pull/39525


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org