How to escape single quote in postgres query via ansible
<p>I am able to execute simple select/delete queries of postgres via ansible playbook. But if my query contains some single quote, it fails. How can I escape a single quote?</p>

<p>Example</p>

<p>This runs fine:</p>

<pre><code>command: psql -U dbuser dbname -c 'SELECT count(*) from table;'
</code></pre>

<p>I want to run this: </p>

<pre><code>command: psql -U dbuser dbname -c 'SELECT count(*) from table where time &lt;= '01-sep-2016';'
</code></pre>

<p>But this is giving me errors.</p>