Troubleshooting
Solutions to common issues when using sql-splitter.
Installation Issues
Section titled “Installation Issues””command not found: sql-splitter”
Section titled “”command not found: sql-splitter””The binary isn’t in your PATH.
Cargo install location:
# Add to your shell profile (~/.bashrc, ~/.zshrc, etc.)export PATH="$HOME/.cargo/bin:$PATH"
# Then reloadsource ~/.bashrc # or ~/.zshrcVerify installation:
which sql-splitterBuild fails with “linker cc not found”
Section titled “Build fails with “linker cc not found””Missing C compiler on Linux.
# Ubuntu/Debiansudo apt-get install build-essential
# Fedora/RHELsudo dnf install gcc
# Then retrycargo install sql-splitterBuild fails on Apple Silicon
Section titled “Build fails on Apple Silicon”Ensure you have Xcode command line tools:
xcode-select --installDialect Detection Issues
Section titled “Dialect Detection Issues””Could not detect SQL dialect”
Section titled “”Could not detect SQL dialect””sql-splitter analyzes the first ~1000 lines to detect the dialect. If your dump starts with generic SQL, detection may fail.
Solution: Explicitly specify the dialect:
sql-splitter split dump.sql -o output/ --dialect mysqlsql-splitter split dump.sql -o output/ --dialect postgresWrong dialect detected
Section titled “Wrong dialect detected”If auto-detection picks the wrong dialect:
# Force specific dialectsql-splitter analyze dump.sql --dialect postgres
# Check what was detectedsql-splitter analyze dump.sql --json | jq '.dialect'Memory Issues
Section titled “Memory Issues””memory allocation failed” or OOM killed
Section titled “”memory allocation failed” or OOM killed”This shouldn’t happen with normal sql-splitter commands (they use ~50MB constant memory). If it does:
-
Check for memory-intensive commands:
validateanddiffwith FK checks can use more memory on very large files. -
Disable FK checks for validation:
Terminal window sql-splitter validate huge.sql --no-fk-checks -
Use disk mode for query:
Terminal window sql-splitter query huge.sql "SELECT ..." --disk -
Limit rows per table:
Terminal window sql-splitter validate huge.sql --max-rows-per-table 100000
File Issues
Section titled “File Issues””No such file or directory"
Section titled “”No such file or directory"”# Check file existsls -la dump.sql
# Use absolute pathsql-splitter split /full/path/to/dump.sql -o output/
# Check permissionschmod +r dump.sql"Permission denied” on output
Section titled “"Permission denied” on output”# Check output directory is writablemkdir -p output/chmod +w output/
# Or write to a different locationsql-splitter split dump.sql -o ~/output/Compressed file not recognized
Section titled “Compressed file not recognized”Ensure the file extension matches the compression format:
| Format | Extension |
|---|---|
| Gzip | .gz |
| Bzip2 | .bz2 |
| XZ | .xz |
| Zstandard | .zst |
# Rename if neededmv dump.sql.gzip dump.sql.gz
# Then processsql-splitter analyze dump.sql.gzParsing Issues
Section titled “Parsing Issues””0 tables found”
Section titled “”0 tables found””The dump file might not contain recognizable SQL statements.
Check file contents:
head -100 dump.sqlCommon causes:
- Binary format (use
pg_dump -Fpfor plain text) - Non-SQL file
- Empty file
- Encoding issues (see below)
Encoding errors or garbled output
Section titled “Encoding errors or garbled output”sql-splitter expects UTF-8 encoding.
Convert encoding:
# Check current encodingfile dump.sql
# Convert from Latin-1 to UTF-8iconv -f ISO-8859-1 -t UTF-8 dump.sql > dump-utf8.sql
# Convert from Windows-1252iconv -f CP1252 -t UTF-8 dump.sql > dump-utf8.sqlStatements split incorrectly
Section titled “Statements split incorrectly”Multi-line strings or unusual quoting can cause issues.
Workaround: Try a different dialect:
# PostgreSQL uses different escaping than MySQLsql-splitter split dump.sql --dialect postgresValidation Issues
Section titled “Validation Issues””Duplicate primary key” false positives
Section titled “”Duplicate primary key” false positives”If you’re validating a dump with intentional duplicates (e.g., for testing):
# Skip PK/FK checkssql-splitter validate dump.sql --no-fk-checksValidation too slow
Section titled “Validation too slow”PK/FK validation reads all data. Speed it up:
# Limit rows checked per tablesql-splitter validate dump.sql --max-rows-per-table 10000
# Skip FK checks entirelysql-splitter validate dump.sql --no-fk-checksQuery Command Issues
Section titled “Query Command Issues””DuckDB error” or query fails
Section titled “”DuckDB error” or query fails”Common causes:
-
SQL syntax: DuckDB uses standard SQL, not MySQL/PostgreSQL extensions
-- MySQL LIMIT with offsetSELECT * FROM users LIMIT 10, 5 -- Won't work-- Standard SQLSELECT * FROM users LIMIT 5 OFFSET 10 -- Works -
Column name conflicts: Use quotes for reserved words
SELECT "order", "user" FROM orders -
Large file: Use disk mode
Terminal window sql-splitter query huge.sql "SELECT ..." --disk
Cache issues
Section titled “Cache issues”# Clear corrupted cachesql-splitter query --clear-cache
# List cached databasessql-splitter query --list-cacheConvert Issues
Section titled “Convert Issues””Unsupported feature” warnings
Section titled “”Unsupported feature” warnings”Some SQL features don’t have direct equivalents across dialects:
- ENUM types → Converted to VARCHAR with CHECK constraint
- AUTO_INCREMENT → Converted to SERIAL (PostgreSQL) or IDENTITY (MSSQL)
- Stored procedures → Skipped (out of scope)
Use --strict to fail on unsupported features instead of warning:
sql-splitter convert dump.sql --to postgres --strictCOPY statements not converted
Section titled “COPY statements not converted”PostgreSQL COPY FROM stdin is converted to INSERT statements:
# This workssql-splitter convert pg_dump.sql --to mysql -o mysql.sqlIf you see raw COPY blocks in output, ensure dialect was detected correctly:
sql-splitter convert pg_dump.sql --from postgres --to mysql -o mysql.sqlSample/Shard Issues
Section titled “Sample/Shard Issues””No rows sampled” or empty output
Section titled “”No rows sampled” or empty output”Check that tables exist:
sql-splitter analyze dump.sql --json | jq '.tables[].name'Ensure required flags are set:
# sample requires --percent OR --rowssql-splitter sample dump.sql --percent 10 -o sample.sql
# shard requires --tenant-value OR --tenant-valuessql-splitter shard dump.sql --tenant-value 123 -o tenant.sqlFK preservation issues
Section titled “FK preservation issues”If related rows are missing:
# Enable FK preservationsql-splitter sample dump.sql --percent 10 --preserve-relations -o sample.sql
# Use strict mode to catch issuessql-splitter sample dump.sql --percent 10 --preserve-relations --strict-fk -o sample.sqlGetting Help
Section titled “Getting Help”Verbose output
Section titled “Verbose output”Most commands support --progress for visibility:
sql-splitter split dump.sql -o output/ --progressJSON for debugging
Section titled “JSON for debugging”Use --json for machine-readable output you can inspect:
sql-splitter analyze dump.sql --json | jq '.'Report bugs
Section titled “Report bugs”If you’ve found a bug:
- Check existing issues
- Create a new issue with:
- sql-splitter version (
sql-splitter --version) - OS and architecture
- Minimal reproduction steps
- Sample SQL (anonymized if needed)
- sql-splitter version (
See Also
Section titled “See Also”- Exit Codes - Understanding return codes
- Compression - Supported formats
- Dialects - Dialect-specific information