forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit40cb21f
committed
Improve PQhost() to return useful data for default Unix-socket connections.
Previously, if no host information had been specified at connection time,PQhost() would return NULL (unless you are on Windows, in which case yougot "localhost"). This is an unhelpful definition for a couple of reasons:it can cause corner-case crashes in applications (cf commitc5ef8ce),and there's no well-defined way for applications to find out the socketdirectory path that's actually in use. As an example of the latterproblem, psql substituted DEFAULT_PGSOCKET_DIR for NULL in a couple ofplaces, but this is subtly wrong because it's conceivable that psql isusing a libpq shared library that was built with a different setting.Hence, change PQhost() to return DEFAULT_PGSOCKET_DIR when appropriate,and strip out the now-dead substitutions in psql. (There is still oneremaining reference to DEFAULT_PGSOCKET_DIR in psql, in prompt.c, whichI don't see a nice way to get rid of. But it only controls a promptabbreviation decision, so it seems noncritical.)Also update the docs for PQhost, which had never previously mentionedthe possibility of a socket directory path being returned. In passingfix the outright-incorrect code comment about PGconn.pgunixsocket.1 parent92e3818 commit40cb21f
File tree
4 files changed
+13
-13
lines changed- doc/src/sgml
- src
- bin/psql
- interfaces/libpq
4 files changed
+13
-13
lines changedLines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1463 | 1463 |
| |
1464 | 1464 |
| |
1465 | 1465 |
| |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
1466 | 1470 |
| |
1467 | 1471 |
| |
1468 | 1472 |
| |
|
Lines changed: 2 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
322 | 322 |
| |
323 | 323 |
| |
324 | 324 |
| |
325 |
| - | |
326 |
| - | |
327 | 325 |
| |
328 | 326 |
| |
329 | 327 |
| |
| |||
1750 | 1748 |
| |
1751 | 1749 |
| |
1752 | 1750 |
| |
1753 |
| - | |
1754 |
| - | |
| 1751 | + | |
1755 | 1752 |
| |
1756 | 1753 |
| |
1757 | 1754 |
| |
1758 | 1755 |
| |
1759 | 1756 |
| |
1760 | 1757 |
| |
1761 |
| - | |
1762 |
| - | |
| 1758 | + | |
1763 | 1759 |
| |
1764 | 1760 |
| |
1765 | 1761 |
| |
| |||
1890 | 1886 |
| |
1891 | 1887 |
| |
1892 | 1888 |
| |
1893 |
| - | |
1894 |
| - | |
1895 | 1889 |
| |
1896 | 1890 |
| |
1897 | 1891 |
| |
|
Lines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5353 | 5353 |
| |
5354 | 5354 |
| |
5355 | 5355 |
| |
5356 |
| - | |
| 5356 | + | |
| 5357 | + | |
| 5358 | + | |
| 5359 | + | |
5357 | 5360 |
| |
5358 | 5361 |
| |
5359 | 5362 |
| |
|
Lines changed: 3 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
302 | 302 |
| |
303 | 303 |
| |
304 | 304 |
| |
305 |
| - | |
306 |
| - | |
307 |
| - | |
308 |
| - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
309 | 308 |
| |
310 | 309 |
| |
311 | 310 |
| |
|
0 commit comments
Comments
(0)