I believe this behavior was introduced during the switch to f-strings in this pgspecial commit, since python3 displays tuples with just a single string differently when using different string formatting methods:
This PR fixes this by making a minor change to unpack the 1-tuple. It also adds a test for displaying view definitions for a view. It is safe to always unpack the 1-tuple in this case since we know cur.rowcount > 0.
I did a cursory search through other instances of f-strings in pgspecial, and this was the only instance that I found that I think is negatively impacted by this behavior.
Checklist
[x] I've added this contribution to the changelog.rst.
[x] I installed pre-commit hooks (pip install pre-commit && pre-commit install), and ran black on my code.
[x] Please squash merge this pull request (uncheck if you'd like us to merge as multiple commits)
Description
Currently in pgcli version 3.5.0, displaying view definitions with
\d+
appears as the following:The view definitions displaying this way is new behavior to 3.5.0 and was not present in pgcli==3.4.1, which is the output shown below:
I believe this behavior was introduced during the switch to f-strings in this pgspecial commit, since python3 displays tuples with just a single string differently when using different string formatting methods:
This PR fixes this by making a minor change to unpack the 1-tuple. It also adds a test for displaying view definitions for a view. It is safe to always unpack the 1-tuple in this case since we know
cur.rowcount > 0
.I did a cursory search through other instances of f-strings in pgspecial, and this was the only instance that I found that I think is negatively impacted by this behavior.
Checklist
changelog.rst
.pip install pre-commit && pre-commit install
), and ranblack
on my code.