Skip to content

fix(opengauss): preserve comments in table DDL - #1875

Merged
openai0229 merged 2 commits into
mainfrom
fix/1874-opengauss-view-ddl-comments
Jul 20, 2026
Merged

openai0229 merged 2 commits into
mainfrom
fix/1874-opengauss-view-ddl-comments

Conversation

@openai0229

Copy link
Copy Markdown
Contributor

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-level SET search_path statement from the displayed/exported DDL.

The SQL statement is defined in OpenGaussMetaDataConstants; OpenGaussMetaData only executes the constant and post-processes the returned DDL.

Affected surfaces

  • Frontend / Web
  • Backend / API / Storage
  • Database plugin / Driver
  • JCEF / Desktop packaging
  • CI / Build / Release
  • Documentation only

Verification

  • Commands and results:
    • rtk mvn -pl chat2db-community-plugins/chat2db-community-opengauss -am -Dmaven.test.skip=false -DskipTests=false -Dtest=OpenGaussMetaDataTest -Dsurefire.failIfNoSpecifiedTests=false test from chat2db-community-server: 3 tests passed, 0 failures/errors/skips; reactor build successful.
    • rtk mvn -DskipTests package: all 48 Community backend modules built successfully.
  • Manual verification: rebuilt and restarted the Community backend from this branch on port 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.
  • UI evidence: N/A; database-plugin backend change.

Risk and compatibility

  • Public API or stored data: N/A; no API contract or stored data changes.
  • Database or driver compatibility: scoped to OpenGauss. It requires the native 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.
  • Network, privacy, or security: no network behavior changes; schema and table values are bound as JDBC parameters.
  • Community / Local / Pro boundary: Community plugin only. Enterprise is intentionally unchanged until the Community fix is reviewed and verified.
  • Backward compatibility: other dialects are untouched. OpenGauss DDL output changes to native formatting and removes only a leading SET search_path ...; statement.

Reviewer map

  • Start here: OpenGaussMetaData#tableDDL, then OpenGaussMetaDataConstants#TABLE_DDL_SQL and OpenGaussMetaDataTest.
  • Failure condition: the target openGauss version lacks pg_get_tabledef(oid), schema/table resolution returns no row, or the native prefix format differs from a leading semicolon-terminated SET search_path statement.
  • Rollback or disable path: revert commit 60da0482; OpenGauss will resume the inherited PostgreSQL DDL reconstruction path.

Contributor declaration

  • I linked the Issue that defines this change.
  • I tested the affected behavior and reported the actual results above.
  • I did not include credentials, private data, or generated build output.
  • I disclosed substantial AI assistance below, or this PR contains no substantial AI-generated code.

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.

@openai0229
openai0229 merged commit 8fc029d into main Jul 20, 2026
9 checks passed
@openai0229
openai0229 deleted the fix/1874-opengauss-view-ddl-comments branch August 5, 2026 03:16
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.

fix(opengauss): preserve comments in table View DDL

1 participant