This file is indexed.

/usr/share/doc/python3-postgresql/html/bin.html is in python3-postgresql 1.1.0-2+b3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Commands &mdash; py-postgresql 1.1.0 documentation</title>
    
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '1.1.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="py-postgresql 1.1.0 documentation" href="index.html" />
    <link rel="next" title="Reference" href="reference.html" />
    <link rel="prev" title="Gotchas" href="gotchas.html" />

   
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">

<link rel="stylesheet" href="_static/unsuck.css" type="text/css" />

  </head>
  <body role="document">  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="commands">
<h1>Commands<a class="headerlink" href="#commands" title="Permalink to this headline"></a></h1>
<p>This chapter discusses the usage of the available console scripts.</p>
<div class="section" id="postgresql-bin-pg-python">
<h2>postgresql.bin.pg_python<a class="headerlink" href="#postgresql-bin-pg-python" title="Permalink to this headline"></a></h2>
<p>The <code class="docutils literal"><span class="pre">pg_python</span></code> command provides a simple way to write Python scripts against a
single target database. It acts like the regular Python console command, but
takes standard PostgreSQL options as well to specify the client parameters
to make establish connection with. The Python environment is then augmented
with the following built-ins:</p>
<blockquote>
<div><dl class="docutils">
<dt><code class="docutils literal"><span class="pre">db</span></code></dt>
<dd>The PG-API connection object.</dd>
<dt><code class="docutils literal"><span class="pre">xact</span></code></dt>
<dd><code class="docutils literal"><span class="pre">db.xact</span></code>, the transaction creator.</dd>
<dt><code class="docutils literal"><span class="pre">settings</span></code></dt>
<dd><code class="docutils literal"><span class="pre">db.settings</span></code></dd>
<dt><code class="docutils literal"><span class="pre">prepare</span></code></dt>
<dd><code class="docutils literal"><span class="pre">db.prepare</span></code>, the statement creator.</dd>
<dt><code class="docutils literal"><span class="pre">proc</span></code></dt>
<dd><code class="docutils literal"><span class="pre">db.proc</span></code></dd>
<dt><code class="docutils literal"><span class="pre">do</span></code></dt>
<dd><code class="docutils literal"><span class="pre">db.do</span></code>, execute a single DO statement.</dd>
<dt><code class="docutils literal"><span class="pre">sqlexec</span></code></dt>
<dd><code class="docutils literal"><span class="pre">db.execute</span></code>, execute multiple SQL statements (<code class="docutils literal"><span class="pre">None</span></code> is always returned)</dd>
</dl>
</div></blockquote>
<div class="section" id="pg-python-usage">
<h3>pg_python Usage<a class="headerlink" href="#pg-python-usage" title="Permalink to this headline"></a></h3>
<p>Usage: postgresql.bin.pg_python [connection options] [script] ...</p>
<dl class="docutils">
<dt>Options:</dt>
<dd><table class="first last docutils option-list" frame="void" rules="none">
<col class="option" />
<col class="description" />
<tbody valign="top">
<tr><td class="option-group">
<kbd><span class="option">--unix=<var>UNIX</var></span></kbd></td>
<td>path to filesystem socket</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--ssl-mode=<var>SSLMODE</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>SSL requirement for connectivity: require, prefer,
allow, disable</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-s <var>SETTINGS</var></span>, <span class="option">--setting=<var>SETTINGS</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>run-time parameters to set upon connecting</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-I <var>PQ_IRI</var></span>, <span class="option">--iri=<var>PQ_IRI</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>database locator string
[pq://user:password&#64;host:port/database?setting=value]</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-h <var>HOST</var></span>, <span class="option">--host=<var>HOST</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>database server host</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-p <var>PORT</var></span>, <span class="option">--port=<var>PORT</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>database server port</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-U <var>USER</var></span>, <span class="option">--username=<var>USER</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>user name to connect as</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-W</span>, <span class="option">--password</span></kbd></td>
<td>prompt for password</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-d <var>DATABASE</var></span>, <span class="option">--database=<var>DATABASE</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>database&#8217;s name</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--pq-trace=<var>PQ_TRACE</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>trace PQ protocol transmissions</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-C <var>PYTHON_CONTEXT</var></span>, <span class="option">--context=<var>PYTHON_CONTEXT</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>Python context code to run[<a class="reference external" href="file://,module">file://,module</a>:,&lt;code&gt;]</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-m <var>PYTHON_MAIN</var></span></kbd></td>
<td>Python module to run as script(__main__)</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-c <var>PYTHON_MAIN</var></span></kbd></td>
<td>Python expression to run(__main__)</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--version</span></kbd></td>
<td>show program&#8217;s version number and exit</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--help</span></kbd></td>
<td>show this help message and exit</td></tr>
</tbody>
</table>
</dd>
</dl>
</div>
<div class="section" id="interactive-console-backslash-commands">
<h3>Interactive Console Backslash Commands<a class="headerlink" href="#interactive-console-backslash-commands" title="Permalink to this headline"></a></h3>
<p>Inspired by <code class="docutils literal"><span class="pre">psql</span></code>:</p>
<div class="highlight-python"><div class="highlight"><pre>&gt;&gt;&gt; \?
Backslash Commands:

  \?      Show this help message.
  \E      Edit a file or a temporary script.
  \e      Edit and Execute the file directly in the context.
  \i      Execute a Python script within the interpreter&#39;s context.
  \set    Configure environment variables. \set without arguments to show all
  \x      Execute the Python command within this process.
</pre></div>
</div>
</div>
<div class="section" id="pg-python-examples">
<h3>pg_python Examples<a class="headerlink" href="#pg-python-examples" title="Permalink to this headline"></a></h3>
<p>Module execution taking advantage of the new built-ins:</p>
<div class="highlight-python"><div class="highlight"><pre>$ python3 -m postgresql.bin.pg_python -h localhost -W -m timeit &quot;prepare(&#39;SELECT 1&#39;).first()&quot;
Password for pg_python[pq://jwp@localhost:5432]:
1000 loops, best of 3: 1.35 msec per loop

$ python3 -m postgresql.bin.pg_python -h localhost -W -m timeit -s &quot;ps=prepare(&#39;SELECT 1&#39;)&quot; &quot;ps.first()&quot;
Password for pg_python[pq://jwp@localhost:5432]:
1000 loops, best of 3: 442 usec per loop
</pre></div>
</div>
<p>Simple interactive usage:</p>
<div class="highlight-python"><div class="highlight"><pre>$ python3 -m postgresql.bin.pg_python -h localhost -W
Password for pg_python[pq://jwp@localhost:5432]:
&gt;&gt;&gt; ps = prepare(&#39;select 1&#39;)
&gt;&gt;&gt; ps.first()
1
&gt;&gt;&gt; c = ps()
&gt;&gt;&gt; c.read()
[(1,)]
&gt;&gt;&gt; ps.close()
&gt;&gt;&gt; import sys
&gt;&gt;&gt; sys.exit(0)
</pre></div>
</div>
</div>
</div>
<div class="section" id="postgresql-bin-pg-dotconf">
<h2>postgresql.bin.pg_dotconf<a class="headerlink" href="#postgresql-bin-pg-dotconf" title="Permalink to this headline"></a></h2>
<p>pg_dotconf is used to modify a PostgreSQL cluster&#8217;s configuration file.
It provides a means to apply settings specified from the command line and from a
file referenced using the <code class="docutils literal"><span class="pre">-f</span></code> option.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last"><code class="docutils literal"><span class="pre">include</span></code> directives in configuration files are <em>completely</em> ignored. If
modification of an included file is desired, the command must be applied to
that specific file.</p>
</div>
<div class="section" id="pg-dotconf-usage">
<h3>pg_dotconf Usage<a class="headerlink" href="#pg-dotconf-usage" title="Permalink to this headline"></a></h3>
<p>Usage: postgresql.bin.pg_dotconf [&#8211;stdout] [-f filepath] postgresql.conf ([param=val]|[param])*</p>
<dl class="docutils">
<dt>Options:</dt>
<dd><table class="first last docutils option-list" frame="void" rules="none">
<col class="option" />
<col class="description" />
<tbody valign="top">
<tr><td class="option-group">
<kbd><span class="option">--version</span></kbd></td>
<td>show program&#8217;s version number and exit</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-h</span>, <span class="option">--help</span></kbd></td>
<td>show this help message and exit</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-f <var>SETTINGS</var></span>, <span class="option">--file=<var>SETTINGS</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>A file of settings to <em>apply</em> to the given
&#8220;postgresql.conf&#8221;</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--stdout</span></kbd></td>
<td>Redirect the product to standard output instead of
writing back to the &#8220;postgresql.conf&#8221; file</td></tr>
</tbody>
</table>
</dd>
</dl>
</div>
<div class="section" id="examples">
<h3>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h3>
<p>Modifying a simple configuration file:</p>
<div class="highlight-python"><div class="highlight"><pre>$ echo &quot;setting = value&quot; &gt;pg.conf

# change &#39;setting&#39;
$ python3 -m postgresql.bin.pg_dotconf pg.conf setting=newvalue

$ cat pg.conf
setting = &#39;newvalue&#39;

# new settings are appended to the file
$ python3 -m postgresql.bin.pg_dotconf pg.conf another_setting=value
$ cat pg.conf
setting = &#39;newvalue&#39;
another_setting = &#39;value&#39;

# comment a setting
$ python3 -m postgresql.bin.pg_dotconf pg.conf another_setting

$ cat pg.conf
setting = &#39;newvalue&#39;
#another_setting = &#39;value&#39;
</pre></div>
</div>
<p>When a setting is given on the command line, it must been seen as one argument
to the command, so it&#8217;s <em>very</em> important to avoid invocations like:</p>
<div class="highlight-python"><div class="highlight"><pre>$ python3 -m postgresql.bin.pg_dotconf pg.conf setting = value
ERROR: invalid setting, &#39;=&#39; after &#39;setting&#39;
HINT: Settings must take the form &#39;setting=value&#39; or &#39;setting_name_to_comment&#39;. Settings must also be received as a single argument.
</pre></div>
</div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Commands</a><ul>
<li><a class="reference internal" href="#postgresql-bin-pg-python">postgresql.bin.pg_python</a><ul>
<li><a class="reference internal" href="#pg-python-usage">pg_python Usage</a></li>
<li><a class="reference internal" href="#interactive-console-backslash-commands">Interactive Console Backslash Commands</a></li>
<li><a class="reference internal" href="#pg-python-examples">pg_python Examples</a></li>
</ul>
</li>
<li><a class="reference internal" href="#postgresql-bin-pg-dotconf">postgresql.bin.pg_dotconf</a><ul>
<li><a class="reference internal" href="#pg-dotconf-usage">pg_dotconf Usage</a></li>
<li><a class="reference internal" href="#examples">Examples</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="index.html">Documentation overview</a><ul>
      <li>Previous: <a href="gotchas.html" title="previous chapter">Gotchas</a></li>
      <li>Next: <a href="reference.html" title="next chapter">Reference</a></li>
  </ul></li>
</ul>
</div>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/bin.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;Python+Postgres.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.5</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.6</a>
      
      |
      <a href="_sources/bin.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>