I've got a script that copies every table in a schema to a csv using the following:
psql -Atc "select tablename from pg_tables where schemaname='$schema'" --host=$host -w --user=$user $database |\
while read TBL; do
psql -c "COPY \"$schema\".\"$TBL\" TO STDOUT WITH DELIMITER AS '|' CSV HEADER" --host=$host -w --user=$user $database > "${TBL}_${timestamp}.csv"
done
Which by and large works great. Now I've been asked if I can:
- Remove the milliseconds from the timestamp output
- Stop CLOBS from being moe than 6000 characters
Is there any way I can continue doing what I'm doing?