I want to load test data into a table in my postgresql database.
I am doing this inside my unit test class.
$this->Application_Model_UserMapper->getDbTable()->getAdapter()->query("COPY users FROM '" . APPLICATION_PATH . "/../tests/dbtestdata/users.csv' CSV HEADER NULL AS E'\N'");
and I get an error message that says I must be a super user to copy to and from a file. Does that mean I need to log in as postgres user? I have read that that could cause security issues, so I am not keen on doing that.
Other option seems to be \COPY, but the following doesnt work..
$this->Application_Model_UserMapper->getDbTable()->getAdapter()->query("
\COPY users FROM '" . APPLICATION_PATH . "/../tests/dbtestdata/users.csv'
CSV HEADER NULL AS E'\N'
");
I get a syntax error.