Created
November 7, 2025 00:58
-
-
Save grizmio/42e6929d82436271e57cb2243498fe73 to your computer and use it in GitHub Desktop.
SMALL postgres in docker dump
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
| #!/bin/bash | |
| # Dump PostgreSQL in Docker with table name, slow as hell but usefull for finding weird values on SMALL databases | |
| DB="furu" | |
| OD="/tmp" | |
| docker exec -t pg psql -t -d $DB -P pager=off -U postgres -c "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_type = 'BASE TABLE'"| tr -d '\r'| grep -v '^$' | while read table; do docker exec -t pg pg_dump -U postgres -d $DB -t $table > "$OD/${table}.sql" ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment