Commit 313f56c
committed
Tweak libpq's PQhost, PQhostaddr, and psql's \connect
Fixes some problems introduced by 6e5f8d4:
* When reusing conninfo data from the previous connection in \connect,
the host address should only be reused if it was specified as
hostaddr; if it wasn't, then 'host' is resolved afresh. We were
reusing the same IP address, which ignores a possible DNS change
as well as any other addresses that the name resolves to than the
one that was used in the original connection.
* PQhost, PQhostaddr: Don't present user-specified hostaddr when we have
an inet_net_ntop-produced equivalent address. The latter has been
put in canonical format, which is cleaner (so it produces "127.0.0.1"
when given "host=2130706433", for example).
* Document the hostaddr-reusing aspect of \connect.
* Fix some code comments
Author: Fabien Coelho
Reported-by: Noah Misch
Discussion: https://postgr.es/m/20190527203713.GA58392@gust.leadboat.com1 parent 3da73d6 commit 313f56c
File tree
3 files changed
+43
-21
lines changed- doc/src/sgml/ref
- src
- bin/psql
- interfaces/libpq
3 files changed
+43
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
911 | 911 | | |
912 | 912 | | |
913 | 913 | | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
914 | 917 | | |
915 | 918 | | |
916 | 919 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2870 | 2870 | | |
2871 | 2871 | | |
2872 | 2872 | | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
2873 | 2893 | | |
2874 | 2894 | | |
2875 | 2895 | | |
| |||
2929 | 2949 | | |
2930 | 2950 | | |
2931 | 2951 | | |
2932 | | - | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
2933 | 2956 | | |
2934 | 2957 | | |
2935 | 2958 | | |
2936 | 2959 | | |
2937 | | - | |
| 2960 | + | |
| 2961 | + | |
2938 | 2962 | | |
2939 | | - | |
2940 | | - | |
2941 | | - | |
2942 | | - | |
2943 | 2963 | | |
2944 | 2964 | | |
2945 | 2965 | | |
2946 | 2966 | | |
2947 | 2967 | | |
2948 | | - | |
2949 | | - | |
| 2968 | + | |
| 2969 | + | |
2950 | 2970 | | |
2951 | 2971 | | |
2952 | 2972 | | |
| |||
3129 | 3149 | | |
3130 | 3150 | | |
3131 | 3151 | | |
3132 | | - | |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
3133 | 3156 | | |
3134 | 3157 | | |
3135 | 3158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1536 | 1536 | | |
1537 | 1537 | | |
1538 | 1538 | | |
1539 | | - | |
1540 | | - | |
1541 | | - | |
| 1539 | + | |
1542 | 1540 | | |
1543 | 1541 | | |
1544 | 1542 | | |
| |||
6463 | 6461 | | |
6464 | 6462 | | |
6465 | 6463 | | |
| 6464 | + | |
| 6465 | + | |
| 6466 | + | |
| 6467 | + | |
6466 | 6468 | | |
6467 | 6469 | | |
6468 | 6470 | | |
| |||
6480 | 6482 | | |
6481 | 6483 | | |
6482 | 6484 | | |
6483 | | - | |
6484 | | - | |
6485 | | - | |
6486 | | - | |
6487 | | - | |
6488 | | - | |
6489 | | - | |
6490 | | - | |
6491 | | - | |
| 6485 | + | |
| 6486 | + | |
| 6487 | + | |
6492 | 6488 | | |
6493 | 6489 | | |
6494 | 6490 | | |
| |||
0 commit comments