------------------------------------------------------------------------
------------------------------------------------------------------------
--\copy "_deletedentitylog" to '_deletedentitylog_backup' csv;
--\copy "_deletedentitylog" to 'C:\backup\_deletedentitylog_backup' csv;
------------------------------------------------------------------------
--If no path is given as in the first example above, file is stored in 
--C:\Program Files\Qlik\Sense\Repository\PostgreSQL\9.6\bin
------------------------------------------------------------------------
------------------------------------------------------------------------

\echo 'Storing _deletedentitylog'
SET CLIENT_ENCODING TO 'UTF8';
\copy "_deletedentitylog" to '_deletedentitylog_backup' csv;
RESET CLIENT_ENCODING;

\echo 'Clearing _deletedentitylog'
DELETE FROM "_deletedentitylog";