I have the following work flow which I'd like to automate with short PHP script.
- Download gzfile (with db dump) from specific URL (potentially FTP).
- Decode the file to txt.
- Import the txt to local postgre with psql (using cmd).
Now I have 2 questions:
- What is the best way to pass the gunzipped file to pg_query?
- I get an error when PHP reaches this line:
COPY rf (datum, id_emailu_op, recency, frequency) FROM stdin; 2011-08-29 8484 3 1. Can the stdin be a problem?
Thank you all!
gzcat dump.gz|psqlat a shell prompt would decompress the .gz file and sent the output directly to postgres.pg_dump -Fcand restore usingpg_restore.