- Notifications
You must be signed in to change notification settings - Fork28
Commit2bbe911
committed
Add a \gexec command to psql for evaluation of computed queries.
\gexec executes the just-entered query, like \g, but instead of printingthe results it takes each field as a SQL command to send to the server.Computing a series of queries to be executed is a fairly common thing,but up to now you always had to resort to kluges like writing the queriesto a file and then inputting the file. Now it can be done with nointermediate step.The implementation is fairly straightforward except for its interactionwith FETCH_COUNT. ExecQueryUsingCursor isn't capable of being calledrecursively, and even if it were, its need to create a transactionblock interferes unpleasantly with the desired behavior of \gexec aftera failure of a generated query (i.e., that it can continue). Therefore,disable use of ExecQueryUsingCursor when doing the master \gexec query.We can still apply it to individual generated queries, however, and theremight be some value in doing so.While testing this feature's interaction with single-step mode, I (tgl) wasled to conclude that SendQuery needs to recognize SIGINT (cancel_pressed)as a negative response to the single-step prompt. Perhaps that's aback-patchable bug fix, but for now I just included it here.Corey Huinker, reviewed by Jim Nasby, Daniel Vérité, and myself1 parent66229ac commit2bbe911
File tree
8 files changed
+207
-6
lines changed- doc/src/sgml/ref
- src
- bin/psql
- test/regress
- expected
- sql
8 files changed
+207
-6
lines changedLines changed: 43 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1766 | 1766 |
| |
1767 | 1767 |
| |
1768 | 1768 |
| |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
1769 | 1812 |
| |
1770 | 1813 |
| |
1771 | 1814 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
871 | 871 |
| |
872 | 872 |
| |
873 | 873 |
| |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
874 | 881 |
| |
875 | 882 |
| |
876 | 883 |
| |
|
Lines changed: 86 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
797 | 797 |
| |
798 | 798 |
| |
799 | 799 |
| |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
800 | 870 |
| |
801 | 871 |
| |
802 | 872 |
| |
| |||
971 | 1041 |
| |
972 | 1042 |
| |
973 | 1043 |
| |
974 |
| - | |
| 1044 | + | |
975 | 1045 |
| |
976 | 1046 |
| |
977 | 1047 |
| |
| |||
989 | 1059 |
| |
990 | 1060 |
| |
991 | 1061 |
| |
992 |
| - | |
| 1062 | + | |
993 | 1063 |
| |
994 | 1064 |
| |
| 1065 | + | |
| 1066 | + | |
995 | 1067 |
| |
996 | 1068 |
| |
997 | 1069 |
| |
| |||
1068 | 1140 |
| |
1069 | 1141 |
| |
1070 | 1142 |
| |
| 1143 | + | |
1071 | 1144 |
| |
1072 | 1145 |
| |
1073 | 1146 |
| |
| |||
1076 | 1149 |
| |
1077 | 1150 |
| |
1078 | 1151 |
| |
| 1152 | + | |
| 1153 | + | |
1079 | 1154 |
| |
1080 | 1155 |
| |
1081 | 1156 |
| |
| |||
1138 | 1213 |
| |
1139 | 1214 |
| |
1140 | 1215 |
| |
1141 |
| - | |
| 1216 | + | |
1142 | 1217 |
| |
1143 | 1218 |
| |
1144 | 1219 |
| |
| |||
1278 | 1353 |
| |
1279 | 1354 |
| |
1280 | 1355 |
| |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
1281 | 1359 |
| |
1282 | 1360 |
| |
1283 | 1361 |
| |
| |||
1423 | 1501 |
| |
1424 | 1502 |
| |
1425 | 1503 |
| |
| 1504 | + | |
| 1505 | + | |
1426 | 1506 |
| |
1427 | 1507 |
| |
1428 | 1508 |
| |
| |||
1499 | 1579 |
| |
1500 | 1580 |
| |
1501 | 1581 |
| |
| 1582 | + | |
1502 | 1583 |
| |
1503 |
| - | |
| 1584 | + | |
| 1585 | + | |
1504 | 1586 |
| |
1505 | 1587 |
| |
1506 | 1588 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
168 | 168 |
| |
169 | 169 |
| |
170 | 170 |
| |
171 |
| - | |
| 171 | + | |
172 | 172 |
| |
173 | 173 |
| |
174 | 174 |
| |
175 | 175 |
| |
176 | 176 |
| |
| 177 | + | |
177 | 178 |
| |
178 | 179 |
| |
179 | 180 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
92 | 92 |
| |
93 | 93 |
| |
94 | 94 |
| |
| 95 | + | |
95 | 96 |
| |
96 | 97 |
| |
97 | 98 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1281 | 1281 |
| |
1282 | 1282 |
| |
1283 | 1283 |
| |
1284 |
| - | |
| 1284 | + | |
1285 | 1285 |
| |
1286 | 1286 |
| |
1287 | 1287 |
| |
|
Lines changed: 45 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
51 | 51 |
| |
52 | 52 |
| |
53 | 53 |
| |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
54 | 99 |
| |
55 | 100 |
| |
56 | 101 |
| |
|
Lines changed: 22 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
38 | 38 |
| |
39 | 39 |
| |
40 | 40 |
| |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
41 | 63 |
| |
42 | 64 |
| |
43 | 65 |
| |
|
0 commit comments
Comments
(0)