Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commited5d819

Browse files
committed
Remove no-longer-appropriate special case in psql's \conninfo code.
\conninfo prints the results of PQhost() and some other libpq functions.It used to override the PQhost() result with the hostaddr parameter ifthat'd been given, but that's unhelpful when multiple hosts were listedin the connection string. Furthermore, it seems unnecessary in the wakeof commit1944cdc, since PQhost does any useful substitution itself.So let's just remove the extra code and print PQhost()'s result withoutany editorialization.Back-patch to v10, as1944cdc (just) was.Discussion:https://postgr.es/m/23287.1533227021@sss.pgh.pa.us
1 parent8d00858 commited5d819

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

‎src/bin/psql/command.c

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -596,25 +596,7 @@ exec_command_conninfo(PsqlScanState scan_state, bool active_branch)
596596
printf(_("You are currently not connected to a database.\n"));
597597
else
598598
{
599-
char*host;
600-
PQconninfoOption*connOptions;
601-
PQconninfoOption*option;
602-
603-
host=PQhost(pset.db);
604-
/* A usable "hostaddr" overrides the basic sense of host. */
605-
connOptions=PQconninfo(pset.db);
606-
if (connOptions==NULL)
607-
{
608-
psql_error("out of memory\n");
609-
exit(EXIT_FAILURE);
610-
}
611-
for (option=connOptions;option&&option->keyword;option++)
612-
if (strcmp(option->keyword,"hostaddr")==0)
613-
{
614-
if (option->val!=NULL&&option->val[0]!='\0')
615-
host=option->val;
616-
break;
617-
}
599+
char*host=PQhost(pset.db);
618600

619601
/* If the host is an absolute path, the connection is via socket */
620602
if (is_absolute_path(host))
@@ -624,8 +606,6 @@ exec_command_conninfo(PsqlScanState scan_state, bool active_branch)
624606
printf(_("You are connected to database \"%s\" as user \"%s\" on host \"%s\" at port \"%s\".\n"),
625607
db,PQuser(pset.db),host,PQport(pset.db));
626608
printSSLInfo();
627-
628-
PQconninfoFree(connOptions);
629609
}
630610
}
631611

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp