I am unable to fire the the below Exec command using golang sql library
db.Exec("\\COPY schema.table TO './tablename.csv' DELIMITER ',' NULL as 'null' CSV HEADER ;")
I get exception syntax error at or near ""\COPY
If I use as below
db.Exec("\COPY schema.table TO './tablename.csv' DELIMITER ',' NULL as 'null' CSV HEADER ;")
I get error like syntax error at or near "\"
I cannot fire COPY TO as command as I should be super user pq: must be superuser to COPY to or from a file
Anyway to fire the \copy to command using sql library?
I am able to run this command successfully from shell prompt using psql