Skip to content

Skip unsupported PostgreSQL views during import - #1116

Open
yzxcj797 wants to merge 1 commit into
drawdb-io:mainfrom
yzxcj797:fix/432-postgres-union-views
Open

Skip unsupported PostgreSQL views during import#1116
yzxcj797 wants to merge 1 commit into
drawdb-io:mainfrom
yzxcj797:fix/432-postgres-union-views

Conversation

@yzxcj797

Copy link
Copy Markdown

Summary

PostgreSQL schema imports currently fail when a CREATE VIEW statement contains a second SELECT after UNION. The SQL parser rejects that view shape before the surrounding tables can be imported.

The diagram model does not represent views, so this change adds a PostgreSQL-specific preprocessing pass that:

  • splits SQL statements while respecting single/double-quoted strings, E'' escapes, line comments, nested block comments, and dollar-quoted bodies;
  • recognizes CREATE, CREATE OR REPLACE, temporary, and materialized view declarations;
  • omits those unsupported view statements before invoking the SQL parser;
  • preserves all other statements, including semicolons inside strings and dollar-quoted procedural bodies.

Testing

  • npm test — 4/4 tests pass
    • multi-SELECT view removal and successful parser round trip
    • temporary/materialized view forms
    • semicolons inside strings and dollar-quoted bodies
    • comments before a view declaration
  • npm run lint — passes with zero warnings
  • npm run build — passes (existing lottie-web eval and large-chunk warnings remain)
  • npx prettier --check on the new files and package manifest — passes
  • git diff --check — passes

Fixes #432.

Split PostgreSQL source with quote, comment, and dollar-quote awareness before parsing, then omit view declarations that the diagram model does not represent. This keeps multi-SELECT views from aborting import of the surrounding tables.
@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

@yzxcj797 is attempting to deploy a commit to the dottle's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

PostgreSQL schema import that contains a multi-SELECT VIEW

1 participant