psql -U moodle_user -d moodle <<EOF
\copy (SELECT * FROM "mdl_files" WHERE "filename" = 'dog-image.jpg' AND "component" = 'question' AND "filearea" = 'questiontext') TO '/moodlefilerecord.csv' (FORMAT 'csv', HEADER)
EOF