snipt

Ctrl+h for KB shortcuts

Bash

Run a PostgreSQL SQL script

psql -v ON_ERROR_STOP=1 -U <username> -d <database_name> -1 -f <sql_file>
https://snipt.net/embed/3180df5e2cee20c0e448a08bb4e8db23/
/raw/3180df5e2cee20c0e448a08bb4e8db23/
3180df5e2cee20c0e448a08bb4e8db23
bash
Bash
1
2019-07-22T11:03:56
True
False
False
Feb 18, 2014 at 05:08 AM
/api/public/snipt/99549/
run-an-postgresql-sql-script
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>psql -v <span class="nv">ON_ERROR_STOP</span><span class="o">=</span><span class="m">1</span> -U &lt;username&gt; -d &lt;database_name&gt; -1 -f &lt;sql_file&gt; </span></pre></div> </td></tr></table>
postgresql