Ini solusinya:
@echo off
SET TableListeFile=C:\Users\mtuna\Documents\dumpfiles\database_list.txt
REM Saveing all tables name of database test_db on a temp file: database_list.txt
psql -U postgres -d test_db -t -c "SELECT table_name FROM information_schema.tables WHERE table_schema='public' AND table_type='BASE TABLE'" -o "%TableListeFile%"
REM Loop on liste tables name:
FOR /F "tokens=*" %%I IN (%TableListeFile%) DO (
REM Dump each table on file
pg_dump -U postgres -h localhost -t %%I test_db > "C:\Users\mtuna\Documents\dumpfiles\%%I.sql"
)
REM Delete temp file
del /Q %TableListeFile%
Ini akan meminta Anda memasukkan kata sandi untuk setiap dump. Jika Anda tidak ingin dipromosikan, Anda dapat menggunakan Pgpass Berkas .
Semoga membantu.
Houari.