Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up\h shows first octet of IP address #964
Comments
|
This sounds like an unintentional side effect of "shortening" host names. In many cases, such as AWS EC2 host names (example: |
|
A patch for the issue below. Please note that this aims to be a very simple solution: a name like Numeric host (and domain) names are legal (except for the top level domain). Nevertheless numeric host names are very rare and entering IP addresses for the host connection is common. Taking care of the @@ -893,6 +893,8 @@
host = self.pgexecute.host or '(none)'
string = string.replace('\\H', host)
short_host, _, _ = host.partition('.')
+ if short_host.isdigit():
+ short_host = host
string = string.replace('\\h', short_host)
string = string.replace('\\d', self.pgexecute.dbname or '(none)')
string = string.replace('\\p', str(self.pgexecute.port) or '(none)') |


Pgcli shows the first octet of an IP address ("127" for example) when giving an IP address as host name. The
\hvariable ("Short hostname of the server (up to first '.')" is part of the default prompt. Since IP addresses don't have a short form, this should probably be the full IP address.Psql shows the same behaviour (in case you aim for consistency with
psqleven in incorrect cases)