Repository navigation
fix(plugins): show a view's own definition in Show DDL and Copy DDL - #3405
Merged
Merged
Conversation
fetchTableDDL now answers a view or materialized view with its own CREATE statement on SQL Server, Oracle, Dameng, DuckDB, Redshift, SQLite, libSQL, D1, SAP HANA, Spanner, Trino and Teradata, instead of a CREATE TABLE rebuilt from its columns or an error.
Oracle view DDL names the view's columns, SQL Server escapes ] by code unit and rewrites only the stale part of a view header, and Cassandra answers a materialized view with its own statement.
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.
Why
Show DDL on a SQL Server view showed a
CREATE TABLEof its columns, with anIDENTITY(1,1)the view never declared. Show DDL, Copy DDL, Structure > DDL and MCP read a view throughfetchTableDDL, which only PostgreSQL and MongoDB answered for a view. The others built a fake table or failed.Change
GOline. Edit View's fallback template names the schema.Verified
New tests cover the SQL Server header and batch rules, a real SQLite view through libSQL, and HANA. The SQL Server queries ran against Azure SQL Edge, the Oracle checks against Oracle 23 Free.
Not in this PR
CREATE VIEWon SQL Server and MySQL, which fails because the view exists.Fixes #3402