I looked around and found the following code on how to import a data dump using pgadmin:
CREATE OR REPLACE FUNCTION db_to_csv(path TEXT) RETURNS void AS $$
tables RECORD;
gmdeclare
statement TEXT;
begin
FOR tables IN
SELECT (table_schema || '.' || table_name) AS schema_table
FROM information_schema.tables t INNER JOIN information_schema.schemata s
ON s.schema_name = t.table_schema
WHERE t.table_schema NOT IN ('pg_catalog', 'information_schema', 'configuration')
ORDER BY schema_table
LOOP
statement := 'COPY ' || tables.schema_table || ' TO ''' || path || '/' || tables.schema_table || '.csv' ||''' DELIMITER '';'' CSV HEADER';
EXECUTE statement;
END LOOP;
return;
end;
$$ LANGUAGE plpgsql;
This looks like exactly what I need since I am pretty new to databases but know my way around .csv files. The problem is, I don't actually know how to set up this function properly. In the definition I need to specify a language (stated to be plpgsql in the answer) and a return type. I'm not sure what the return type should be. Moreover, and this probably sounds pretty silly, I'd like to confirm that I should replace TEXT with the path to my .sql dump file. Thanks for any and all help!