44This chapter discusses the usage of the available console scripts.
55
66
7- `` pg_python``
8- =============
7+ postgresql.bin. pg_python
8+ ========================
99
1010The ``pg_python`` command provides a simple way to write Python scripts against a
1111single target database. It acts like the regular Python console command, but
@@ -37,7 +37,7 @@ with the following built-ins:
3737pg_python Usage
3838---------------
3939
40- Usage: pg_python.py [connection options] [script] ...
40+ Usage: postgresql.bin.pg_python [connection options] [script] ...
4141
4242Options:
4343 --unix=UNIX path to filesystem socket
@@ -85,17 +85,17 @@ pg_python Examples
8585
8686Module execution taking advantage of the new built-ins::
8787
88- $ pg_python -h localhost -W -m timeit "prepare('SELECT 1').first()"
88+ $ python3 -m postgresql.bin. pg_python -h localhost -W -m timeit "prepare('SELECT 1').first()"
8989 Password for pg_python[pq://jwp@localhost:5432]:
9090 1000 loops, best of 3: 1.35 msec per loop
9191
92- $ pg_python -h localhost -W -m timeit -s "ps=prepare('SELECT 1')" "ps.first()"
92+ $ python3 -m postgresql.bin. pg_python -h localhost -W -m timeit -s "ps=prepare('SELECT 1')" "ps.first()"
9393 Password for pg_python[pq://jwp@localhost:5432]:
9494 1000 loops, best of 3: 442 usec per loop
9595
9696Simple interactive usage::
9797
98- $ pg_python -h localhost -W
98+ $ python3 -m postgresql.bin. pg_python -h localhost -W
9999 Password for pg_python[pq://jwp@localhost:5432]:
100100 >>> ps = prepare('select 1')
101101 >>> ps.first()
@@ -108,8 +108,8 @@ Simple interactive usage::
108108 >>> sys.exit(0)
109109
110110
111- `` pg_dotconf``
112- ==============
111+ postgresql.bin. pg_dotconf
112+ =========================
113113
114114pg_dotconf is used to modify a PostgreSQL cluster's configuration file.
115115It provides a means to apply settings specified from the command line and from a
@@ -124,7 +124,7 @@ file referenced using the ``-f`` option.
124124pg_dotconf Usage
125125----------------
126126
127- Usage: pg_dotconf.py [--stdout] [-f filepath] postgresql.conf ([param=val]|[param])*
127+ Usage: postgresql.bin.pg_dotconf [--stdout] [-f filepath] postgresql.conf ([param=val]|[param])*
128128
129129Options:
130130 --version show program's version number and exit
@@ -144,19 +144,19 @@ Modifying a simple configuration file::
144144 $ echo "setting = value" >pg.conf
145145
146146 # change 'setting'
147- $ pg_dotconf pg.conf setting=newvalue
147+ $ python3 -m postgresql.bin. pg_dotconf pg.conf setting=newvalue
148148
149149 $ cat pg.conf
150150 setting = 'newvalue'
151151
152152 # new settings are appended to the file
153- $ pg_dotconf pg.conf another_setting=value
153+ $ python3 -m postgresql.bin. pg_dotconf pg.conf another_setting=value
154154 $ cat pg.conf
155155 setting = 'newvalue'
156156 another_setting = 'value'
157157
158158 # comment a setting
159- $ pg_dotconf pg.conf another_setting
159+ $ python3 -m postgresql.bin. pg_dotconf pg.conf another_setting
160160
161161 $ cat pg.conf
162162 setting = 'newvalue'
@@ -165,6 +165,6 @@ Modifying a simple configuration file::
165165When a setting is given on the command line, it must been seen as one argument
166166to the command, so it's *very* important to avoid invocations like::
167167
168- $ pg_dotconf pg.conf setting = value
168+ $ python3 -m postgresql.bin. pg_dotconf pg.conf setting = value
169169 ERROR: invalid setting, '=' after 'setting'
170170 HINT: Settings must take the form 'setting=value' or 'setting_name_to_comment'. Settings must also be received as a single argument.
0 commit comments