Skip to content

Commit 70ecc77

Browse files
author
James William Pye
committed
Minor documentation updates and remove --role.
--role didn't have any support with connectors/connections, so remove it entirely. It will likely be implemented later.
1 parent 5e23ed4 commit 70ecc77

5 files changed

Lines changed: 17 additions & 34 deletions

File tree

postgresql/clientparameters.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def getuser():
8686
'KRBSRVNAME' : 'kerberos5_service',
8787

8888
# Extensions
89-
'ROLE' : 'role', # SET ROLE $PGROLE
89+
#'ROLE' : 'role', # SET ROLE $PGROLE
9090

9191
# This keyword *should* never make it to a connect() function
9292
# as `resolve_password` should be called to fill in the
@@ -144,8 +144,6 @@ def envvars(environ = os.environ, modifier : "environment variable key modifier"
144144
PGKRBSVRNAME -> kerberos5_service
145145
PGSSLKEY -> sslkey
146146
147-
PGROLE -> role (role to set when connected)
148-
149147
PGTZ -> settings['timezone']
150148
PGDATESTYLE -> settings['datestyle']
151149
PGCLIENTENCODING -> settings['client_encoding']
@@ -262,12 +260,6 @@ def append_settings(option, opt_str, value, parser):
262260
type = 'choice',
263261
)
264262

265-
option_role = make_option('--role',
266-
dest = 'role',
267-
help = 'run operation as the role',
268-
type = 'str',
269-
)
270-
271263
def append_db_client_x_parameters(option, opt_str, value, parser):
272264
parser.values.db_client_parameters.append((option.dest, value))
273265
make_x_option = partial(make_option, callback = append_db_client_x_parameters)
@@ -313,7 +305,6 @@ def _add_help_option(self):
313305
default_optparse_options = [
314306
option_unix,
315307
option_sslmode,
316-
option_role,
317308
option_settings,
318309
# Complex Options
319310
option_iri,
@@ -323,7 +314,7 @@ def _add_help_option(self):
323314
class DefaultParser(StandardParser):
324315
"""
325316
Parser that includes a variety of connectivity options.
326-
(IRI, sslmode, role(set role), settings)
317+
(IRI, sslmode, settings)
327318
"""
328319
standard_option_list = default_optparse_options
329320

postgresql/documentation/admin.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
2727
$ /usr/opt/bin/python3.0 ./setup.py install
2828
29-
Under most POSIX systems, the above should work without problem. However, if it
30-
does fail, it is likely due to a C extension.
29+
Under most POSIX systems, the above should work without problem if the proper
30+
Python executable is referenced. However, if it does fail, it is likely due
31+
to a C extension's inability to compile.
3132
3233
The building of C extensions can be disable using the ``PY_BUILD_EXTENSIONS``
3334
environment variable::
@@ -50,12 +51,14 @@
5051
C:\-> setenv PY_BUILD_EXTENSIONS 1
5152
C:\-> c:\python30\python setup.py install
5253
53-
Or more likely, compile using mingw32::
54+
Or, more likely, compile using mingw32::
5455
5556
C:\-> setenv PY_BUILD_EXTENSIONS 1
5657
C:\-> c:\python30\python setup.py build_ext --compiler=mingw32
5758
C:\-> c:\python30\python setup.py install
5859
60+
See http://www.mingw.org/ to get the compiler.
61+
5962
6063
Environment
6164
-----------

postgresql/documentation/bin.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
1515
The ``pg_python`` command provides a simple way to write Python scripts against a
1616
single target database. It acts like the regular Python console command, but
17-
then takes standard PostgreSQL options as well to specify the client parameters
18-
to make the connection with. The Python environment is then augmented with the
19-
following additional built-ins:
17+
takes standard PostgreSQL options as well to specify the client parameters
18+
to make establish connection with. The Python environment is then augmented
19+
with the following built-ins:
2020
2121
``db``
2222
The PG-API connection object.
@@ -43,7 +43,6 @@
4343
--unix=UNIX path to filesystem socket
4444
--ssl-mode=SSLMODE SSL requirement for connectivity: require, prefer,
4545
allow, disable
46-
--role=ROLE run operation as the role
4746
-s SETTINGS, --setting=SETTINGS
4847
run-time parameters to set upon connecting
4948
-I PQ_IRI, --iri=PQ_IRI
@@ -112,12 +111,12 @@
112111
``pg_dotconf``
113112
==============
114113
115-
pg_dotconf is used to safely modify a PostgreSQL cluster's configuration file.
114+
pg_dotconf is used to modify a PostgreSQL cluster's configuration file.
116115
It provides a means to apply settings specified from the command line and from a
117116
file referenced using the ``-f`` option.
118117
119118
.. warning::
120-
``include`` directives in configuration files are completely ignored. If
119+
``include`` directives in configuration files are *completely* ignored. If
121120
modification of an included file is desired, the command must be applied to
122121
that specific file.
123122

postgresql/driver/pq3.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,16 +2056,6 @@ class Connection(pg_api.Connection):
20562056

20572057
_socketfactory = None
20582058

2059-
def user():
2060-
def fget(self):
2061-
return self.prepare('SELECT current_user').first()
2062-
def fset(self, val):
2063-
return self.execute('SET ROLE "%s"' %(val.replace('"', '""'),))
2064-
def fdel(self):
2065-
self.execute("RESET ROLE")
2066-
return locals()
2067-
user = property(**user())
2068-
20692059
_tracer = None
20702060
def tracer():
20712061
def fget(self):

postgresql/test/test_connect.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def test_md5_connect(self):
167167
**self.params
168168
)
169169
with c:
170-
self.failUnlessEqual(c.user, 'md5')
170+
self.failUnlessEqual(c.prepare('select current_user').first(), 'md5')
171171

172172
def test_crypt_connect(self):
173173
if self.do_crypt:
@@ -178,7 +178,7 @@ def test_crypt_connect(self):
178178
**self.params
179179
)
180180
with c:
181-
self.failUnlessEqual(c.user, 'crypt')
181+
self.failUnlessEqual(c.prepare('select current_user').first(), 'crypt')
182182

183183
def test_password_connect(self):
184184
c = self.cluster.connection(
@@ -187,7 +187,7 @@ def test_password_connect(self):
187187
database = 'test',
188188
)
189189
with c:
190-
self.failUnlessEqual(c.user, 'password')
190+
self.failUnlessEqual(c.prepare('select current_user').first(), 'password')
191191

192192
def test_trusted_connect(self):
193193
c = self.cluster.connection(
@@ -197,7 +197,7 @@ def test_trusted_connect(self):
197197
**self.params
198198
)
199199
with c:
200-
self.failUnlessEqual(c.user, 'trusted')
200+
self.failUnlessEqual(c.prepare('select current_user').first(), 'trusted')
201201

202202
if __name__ == '__main__':
203203
unittest.main()

0 commit comments

Comments
 (0)