Skip to content

Instantly share code, notes, and snippets.

@grizmio
Created November 7, 2025 00:58
Show Gist options
  • Select an option

  • Save grizmio/42e6929d82436271e57cb2243498fe73 to your computer and use it in GitHub Desktop.

Select an option

Save grizmio/42e6929d82436271e57cb2243498fe73 to your computer and use it in GitHub Desktop.
SMALL postgres in docker dump
#!/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