Repository navigation
feat(linux): export a database to a SQL file and import SQL files - #4052
Merged
Merged
Conversation
…mote rows and secrets
… close nested import transactions
…n keys on for plain scripts
…t post-data checks call before the rows
…nd hold NOT VALID domain checks for after the rows
…e and break name cycles at weak mentions
…ump order and read MariaDB mode markers
…aliases and pass over zero-column rows
…les and refuse two-phase commands in an import
…n and read routine bodies under their sql_mode
…ad SET across any whitespace
…ort partition expressions and never commit a stopped import
…r SQL Server outcome and list indexed-view indexes
…tgreSQL view columns
…L dump leaves out
datlechin
marked this pull request as ready for review
November 5, 2026 11:09
datlechin
enabled auto-merge (squash)
November 5, 2026 11:09
…workspace clippy errors
…ist the import file for translation
…en, not as markup
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.
Summary
.sqlor.sql.gzfile in the orderpg_dumpandmysqldumpuse, so the engine's own client loads it too.Connection::read_dump_catalogreads the catalog (server text where the engine keeps one) andSqlDialect::dumpframes the file (mysqldump'sSETheader andDELIMITER ;;,GObatches, pg_dump's header).tablepro_core::dump::write_dumporders it by what each object names and writes rows as multi-row INSERTs throughstream_read..sqlor.sql.gzfile of any size on an editor session of its own, split as the engine's client splits it (ScriptReader:DELIMITER,GO n, routine bodies, dollar quotes), with Stop at First Error or continue, one transaction on PostgreSQL, SQL Server, SQLite and DuckDB, progress with Stop, and a summary of failures by line.COPY ... FROM stdinrows run as INSERTs,\restrictand\unrestrictare passed over, other psql commands are refused by line.pg_dumpormysqldump.IDENTITY(1,1).Deliberately not fixed here
SET schemakeep unqualified names in their stored text, and DuckDB does not record which schema bound them. Such a body fails to load from a file. Rewriting the names needs the binder's resolution, which DuckDB does not expose.pg_extension_config_dump, such as pg_partman's) are not written; the extension makes the tables again, empty. Their row filters are SQL text the browse reader cannot take.Test plan
dump_loads_back_into_an_empty_databaseon PostgreSQL, MySQL, MariaDB, SQL Server and ClickHouse (Docker) and SQLite and DuckDB (unit suite): the sample database is dumped, loaded into an empty database through the import, and dumped again to the same file.native_dump_loads_through_the_import: files written bypg_dump18,mysqldump8.4,mariadb-dump11.4 andsqlite33.46 load, as one transaction and as written.