You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "iamhucong (via GitHub)" <gi...@apache.org> on 2026/08/12 10:36:03 UTC
[PR] Parse openGauss column nullability constraints [shardingsphere]
iamhucong opened a new pull request, #39425:
URL: https://github.com/apache/shardingsphere/pull/39425
Fix openGauss `CREATE TABLE` column nullability metadata.
### Problem
The openGauss grammar accepts column-level `NOT NULL` and `NULL`, but `OpenGaussDDLStatementVisitor` always constructed `ColumnDefinitionSegment` with `notNull=false`.
The openGauss 6.0 SQL Reference documents `NOT NULL` as disallowing null values and `NULL` as allowing them: https://docs.opengauss.org/en/docs/6.0.0/docs/SQLReference/create-table.html
### Change
- Detect `NOT NULL` in the existing `columnConstraint` AST.
- Add a focused openGauss parser case covering explicit `NOT NULL` and `NULL` behavior.
- Add the ShardingSphere 5.5.4 bug-fix release note.
### Verification
- RED: the new case was the only failure among 923 openGauss parser tests before the visitor change.
- `InternalOpenGaussParserIT`: 923 tests passed.
- openGauss parser module: 3 tests passed.
- Spotless passed.
- Checkstyle reported 0 violations.
- `git diff --check` passed.
--
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] Parse openGauss column nullability constraints [shardingsphere]
Posted by "FlyingZC (via GitHub)" <gi...@apache.org>.
FlyingZC merged PR #39425:
URL: https://github.com/apache/shardingsphere/pull/39425
--
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] Parse openGauss column nullability constraints [shardingsphere]
Posted by "iamhucong (via GitHub)" <gi...@apache.org>.
iamhucong commented on PR #39425:
URL: https://github.com/apache/shardingsphere/pull/39425#issuecomment-5265656420
### Result
**Review Result: Mergeable**
The change correctly preserves openGauss `CREATE TABLE` column-level `NOT NULL` and `NULL` metadata. I found no blocking code-correctness issues.
### Evidence
- Reviewed public head: `3213f60f933fa80763d2bdc08b30186cf7f22b12`.
- Before this change, `OpenGaussDDLStatementVisitor.visitColumnDefinition()` always constructed `ColumnDefinitionSegment` with `notNull=false`.
- The new condition sets `notNull=true` only when the same `columnConstraintOption` contains both `NOT` and `NULL`; explicit `NULL` remains `false`.
- The existing openGauss grammar already models this syntax as `NOT? NULL`; no grammar change is required.
- The openGauss 6.0 SQL Reference confirms that `NOT NULL` disallows null values and `NULL` allows them as the default setting: https://docs.opengauss.org/en/docs/6.0.0/docs/SQLReference/create-table.html
- The openGauss-only parser case exercises the public parser path and verifies both boundaries:
- `order_id INT NOT NULL` → `not-null="true"`
- `user_id INT NULL` → `not-null="false"`
- `ColumnDefinitionAssert` directly compares `ColumnDefinitionSegment.isNotNull()`, and the binder preserves this value.
- The implementation matches the maintained PostgreSQL sibling visitor for the same grammar structure.
- Sanitized local verification:
- RED: the new case was the only failure among 923 openGauss parser tests before the visitor fix.
- GREEN: all 923 openGauss parser tests passed.
- The openGauss parser module passed all 3 tests.
- Spotless passed.
- Checkstyle reported 0 violations.
- Triple-dot `git diff --check` passed.
### Coverage
- Accounted for all 4 files in the authoritative GitHub changed-file list:
- `parser/sql/engine/dialect/opengauss/src/main/java/org/apache/shardingsphere/sql/parser/engine/opengauss/visitor/statement/type/OpenGaussDDLStatementVisitor.java`
- `test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml`
- `test/it/parser/src/main/resources/case/ddl/create-table.xml`
- `RELEASE-NOTES.md`
- The local triple-dot file list matched GitHub; merge base: `e1ec6c953014b346f7786d91cd9edc2e2c7583ab`.
- Reviewed the openGauss DDL visitor entry path, grammar AST, `NOT NULL`/`NULL` boundaries, binder propagation, metadata consumers, test assertion path, segment bounds, PostgreSQL sibling implementation, and the 5.5.4 release-note link.
- `OpenGaussDDLStatementVisitor` is an independent dialect visitor. Other dialects use separate visitors and are unaffected by this change.
- No public API, SPI, grammar, dependency, configuration, packaging, or generated-source contract changes.
- Root-cause, blast-radius, tests/runtime/operations, and final full-scope convergence reviews completed with no unresolved evidence gaps.
- This is a code-scope review only; CI was not reviewed.
--
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