summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmjith Ramanujam <amjith.r@gmail.com>2017-05-01 09:51:44 -0700
committerGitHub <noreply@github.com>2017-05-01 09:51:44 -0700
commit81fb73f4b0343162f2ccc4d2d97893d4a0d2ee29 (patch)
tree0f3956e154ce9ae640a24dc5f26225de8c664fba
parent2e4b907b19403960bcb0882b150c732e5d47ec5d (diff)
parentb0d77c1021589988b04c2bc11a19f945761740aa (diff)
Merge pull request #708 from dbcli/j-bennet/fix-user-precedence
User option should take precedence over environment variable.
-rw-r--r--changelog.rst1
-rwxr-xr-xpgcli/main.py2
2 files changed, 2 insertions, 1 deletions
diff --git a/changelog.rst b/changelog.rst
index e8bbd9c9..2ee470c8 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -14,6 +14,7 @@ Bug fixes:
* Fixed external editor bug (issue #668). (Thanks: `Irina Truong`_).
* Standardize command line option names. (Thanks: `Russell Davies`_)
* Improve handling of ``lock_not_available`` error (issue #700). (Thanks: `Jackson Popkin <https://github.com/jdpopkin>`_)
+* Fixed user option precedence (issue #697). (Thanks: `Irina Truong`_).
Internal changes:
-----------------
diff --git a/pgcli/main.py b/pgcli/main.py
index 9da6d116..3071f970 100755
--- a/pgcli/main.py
+++ b/pgcli/main.py
@@ -793,7 +793,7 @@ def cli(database, username_opt, host, port, prompt_passwd, never_prompt,
# Choose which ever one has a valid value.
database = database or dbname
- user = username or username_opt
+ user = username_opt or username
if dsn is not '':
try: