fix(opengauss): preserve comments in table DDL - #1875
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue
Closes #1874
Summary
Use openGauss's native
pg_get_tabledef(table_oid)path for table DDL so table and column comments are preserved. Resolve the table OID with parameterized schema and table predicates, and remove only the leading session-levelSET search_pathstatement from the displayed/exported DDL.The SQL statement is defined in
OpenGaussMetaDataConstants;OpenGaussMetaDataonly executes the constant and post-processes the returned DDL.Affected surfaces
Verification
rtk mvn -pl chat2db-community-plugins/chat2db-community-opengauss -am -Dmaven.test.skip=false -DskipTests=false -Dtest=OpenGaussMetaDataTest -Dsurefire.failIfNoSpecifiedTests=false testfromchat2db-community-server: 3 tests passed, 0 failures/errors/skips; reactor build successful.rtk mvn -DskipTests package: all 48 Community backend modules built successfully.10825; health request returned HTTP 200. The active Community storage does not contain an openGauss datasource, so no live Community UI/database call was claimed. Issue fix(opengauss): preserve comments in table View DDL #1874 contains the same-table openGauss 7.0.0-RC3 native-function evidence.Risk and compatibility
pg_get_tabledef(oid)overload. Native output can differ from the inherited PostgreSQL catalog reconstruction, including owner/grant statements; this PR intentionally follows the native OpenGauss DDL contract to preserve comments.SET search_path ...;statement.Reviewer map
OpenGaussMetaData#tableDDL, thenOpenGaussMetaDataConstants#TABLE_DDL_SQLandOpenGaussMetaDataTest.pg_get_tabledef(oid), schema/table resolution returns no row, or the native prefix format differs from a leading semicolon-terminatedSET search_pathstatement.60da0482; OpenGauss will resume the inherited PostgreSQL DDL reconstruction path.Contributor declaration
AI assistance: Substantial AI assistance was used for source tracing, implementation, test construction, verification, and PR drafting. The resulting diff and verification output were reviewed before submission.