forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit276591b
committed
psql: fix \connect with URIs and conninfo strings
psql was already accepting conninfo strings as the first parameter in\connect, but the way it worked wasn't sane; some of the otherparameters would get the previous connection's values, causing it toconnect to a completely unexpected server or, more likely, not findingany server at all because of completely wrong combinations ofparameters.Fix by explicitely checking for a conninfo-looking parameter in thedbname position; if one is found, use its complete specification ratherthan mix with the other arguments. Also, change tab-completion to nottry to complete conninfo/URI-looking "dbnames" and document thatconninfos are accepted as first argument.There was a weak consensus to backpatch this, because while the behaviorof using the dbname as a conninfo is nowhere documented for \connect, itis reasonable to expect that it works because it does work in many othercontexts. Therefore this is backpatched all the way back to 9.0.To implement this, routines previously private to libpq have beenduplicated so that psql can decide what looks like a conninfo/URIstring. In back branches, just duplicate the same code all the way backto 9.2, where URIs where introduced; 9.0 and 9.1 have a simpler version.In master, the routines are moved to src/common and renamed.Author: David Fetter, Andrew Dunstan. Some editorialization by me(probably earning a Gierth's "Sloppy" badge in the process.)Reviewers: Andrew Gierth, Erik Rijkers, Pavel Stěhule, Stephen Frost,Robert Haas, Andrew Dunstan.1 parent41d2cb8 commit276591b
File tree
6 files changed
+96
-34
lines changed- doc/src/sgml/ref
- src/bin/psql
6 files changed
+96
-34
lines changedLines changed: 28 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
745 | 745 |
| |
746 | 746 |
| |
747 | 747 |
| |
748 |
| - | |
| 748 | + | |
749 | 749 |
| |
750 | 750 |
| |
751 | 751 |
| |
752 |
| - | |
753 |
| - | |
754 |
| - | |
755 |
| - | |
756 |
| - | |
757 |
| - | |
758 |
| - | |
759 |
| - | |
760 |
| - | |
761 |
| - | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
762 | 755 |
| |
763 | 756 |
| |
764 | 757 |
| |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
765 | 773 |
| |
766 | 774 |
| |
767 | 775 |
| |
| |||
771 | 779 |
| |
772 | 780 |
| |
773 | 781 |
| |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
774 | 791 |
| |
775 | 792 |
| |
776 | 793 |
| |
|
Lines changed: 49 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1467 | 1467 |
| |
1468 | 1468 |
| |
1469 | 1469 |
| |
| 1470 | + | |
| 1471 | + | |
1470 | 1472 |
| |
1471 |
| - | |
1472 |
| - | |
| 1473 | + | |
1473 | 1474 |
| |
1474 | 1475 |
| |
1475 | 1476 |
| |
1476 | 1477 |
| |
1477 | 1478 |
| |
1478 | 1479 |
| |
1479 | 1480 |
| |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
1480 | 1502 |
| |
1481 | 1503 |
| |
1482 | 1504 |
| |
| |||
1491 | 1513 |
| |
1492 | 1514 |
| |
1493 | 1515 |
| |
1494 |
| - | |
| 1516 | + | |
1495 | 1517 |
| |
1496 | 1518 |
| |
1497 | 1519 |
| |
| |||
1501 | 1523 |
| |
1502 | 1524 |
| |
1503 | 1525 |
| |
1504 |
| - | |
1505 |
| - | |
1506 |
| - | |
1507 |
| - | |
1508 |
| - | |
1509 |
| - | |
1510 |
| - | |
1511 |
| - | |
1512 |
| - | |
1513 |
| - | |
1514 |
| - | |
1515 |
| - | |
1516 |
| - | |
1517 |
| - | |
1518 |
| - | |
1519 |
| - | |
1520 |
| - | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
1521 | 1550 |
| |
1522 | 1551 |
| |
1523 | 1552 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1574 | 1574 |
| |
1575 | 1575 |
| |
1576 | 1576 |
| |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + |
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
63 | 63 |
| |
64 | 64 |
| |
65 | 65 |
| |
| 66 | + | |
| 67 | + | |
66 | 68 |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
251 | 251 |
| |
252 | 252 |
| |
253 | 253 |
| |
254 |
| - | |
| 254 | + | |
255 | 255 |
| |
256 | 256 |
| |
257 | 257 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2776 | 2776 |
| |
2777 | 2777 |
| |
2778 | 2778 |
| |
2779 |
| - | |
2780 |
| - | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
2781 | 2783 |
| |
2782 | 2784 |
| |
2783 | 2785 |
| |
|
0 commit comments
Comments
(0)