Update psql-to-csv.md

This commit is contained in:
ruslan 2024-09-13 12:34:35 +02:00 committed by GitHub
parent 45ecaf391b
commit 53c9288161
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,7 +14,7 @@ DECLARE
r RECORD; r RECORD;
BEGIN BEGIN
FOR r IN (SELECT table_name FROM information_schema.tables WHERE table_schema = 'public') LOOP FOR r IN (SELECT table_name FROM information_schema.tables WHERE table_schema = 'public') LOOP
EXECUTE format('COPY %I TO %L WITH (FORMAT CSV, HEADER)', r.table_name, '/<path-to-csv>/' r.table_name '.csv'); EXECUTE format('COPY %I TO %L WITH (FORMAT CSV, HEADER)', r.table_name, '/<path-to-csv>/' || r.table_name || '.csv');
END LOOP; END LOOP;
END $$; END $$;
``` ```