mirror of
https://github.com/fruworg/fruworg.github.io.git
synced 2024-11-17 01:47:18 +03:00
487 B
487 B
title | description | date | tags | ||
---|---|---|---|---|---|
Конвертация PostgreSQL в CSV | pSQL to CSV | 2024-09-11T17:24:00+02:00 |
|
Конвертация
psql -d <database>
DO $$
DECLARE
r RECORD;
BEGIN
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');
END LOOP;
END $$;