Skip to content

feat: support PostgreSQL CREATE TABLE AS data population - #2689

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:feat/postgresql-ctas-data
Sep 24, 2026
Merged

manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:feat/postgresql-ctas-data

Conversation

@minleejae

@minleejae minleejae commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Support CREATE TABLE ... AS query WITH DATA and WITH NO DATA, preserving the omitted/true/false distinction in the AST. This lets schema tooling retain whether CTAS should populate rows.

Reuse one data-population grammar production with CREATE MATERIALIZED VIEW, and the existing shared query renderer for CreateTable.toString and the deparser. Tests cover SELECT, TABLE, VALUES, parentheses, CTEs, and set operations.

Validation:

  • Full Gradle check passed (Java 17), including grammar ambiguity, unit tests, coverage, formatting, Checkstyle, PMD, and SpotBugs.
  • On PostgreSQL 17.11, the same query created two rows WITH DATA and zero rows WITH NO DATA for all three SQL renderings.
  • Added AST, mutation, and parse/deparse regression coverage.

Syntax reference: official documentation.

Additional version-boundary validation: the original, toString, and deparser SQL was executed on PostgreSQL 18.6, including the focused behavioral cases. Reviewed the PostgreSQL 18 grammar. Runtime version numbers above identify the tested binaries; this does not claim support for every statement in those DBMS versions.

Signed-off-by: minleejae <mmj9808@gmail.com>
@manticore-projects
manticore-projects merged commit d24e1e2 into JSQLParser:master Sep 24, 2026
10 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Thank you!

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.

2 participants