- Notifications
You must be signed in to change notification settings - Fork5
Commit101d6ae
committed
Prevent "\g filename" from affecting subsequent commands after an error.
In the previous coding, psql's state variable saying that output shouldgo to a file was only reset after successful completion of a queryreturning tuples. Thus for example,regression=# select 1/0regression-# \g somefileERROR: division by zeroregression=# select 1/2;regression=#... huh, I wonder where that output went. Even more oddly, the statewas not reset even if it's the file that's causing the failure:regression=# select 1/2 \g /foo/foo: Permission deniedregression=# select 1/2;/foo: Permission deniedregression=# select 1/2;/foo: Permission deniedThis seems to me not to satisfy the principle of least surprise.\g is certainly not documented in a way that suggests its effects areat all persistent.To fix, adjust the code so that the flag is reset at exit from SendQueryno matter what happened.Noted while reviewing the \gset patch, which had comparable issues.Arguably this is a bug fix, but I'll refrain from back-patching for now.1 parent84725aa commit101d6ae
File tree
3 files changed
+27
-17
lines changed- doc/src/sgml/ref
- src/bin/psql
3 files changed
+27
-17
lines changedLines changed: 7 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1608 | 1608 |
| |
1609 | 1609 |
| |
1610 | 1610 |
| |
1611 |
| - | |
1612 |
| - | |
1613 |
| - | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
1614 | 1618 |
| |
1615 | 1619 |
| |
1616 | 1620 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
731 | 731 |
| |
732 | 732 |
| |
733 | 733 |
| |
734 |
| - | |
| 734 | + | |
735 | 735 |
| |
736 | 736 |
| |
737 | 737 |
| |
|
Lines changed: 19 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
607 | 607 |
| |
608 | 608 |
| |
609 | 609 |
| |
610 |
| - | |
611 |
| - | |
612 |
| - | |
613 | 610 |
| |
614 | 611 |
| |
615 | 612 |
| |
| |||
835 | 832 |
| |
836 | 833 |
| |
837 | 834 |
| |
838 |
| - | |
839 |
| - | |
| 835 | + | |
| 836 | + | |
840 | 837 |
| |
841 | 838 |
| |
842 | 839 |
| |
843 | 840 |
| |
844 | 841 |
| |
845 |
| - | |
| 842 | + | |
846 | 843 |
| |
847 | 844 |
| |
848 | 845 |
| |
| |||
856 | 853 |
| |
857 | 854 |
| |
858 | 855 |
| |
859 |
| - | |
| 856 | + | |
860 | 857 |
| |
861 | 858 |
| |
862 | 859 |
| |
| |||
887 | 884 |
| |
888 | 885 |
| |
889 | 886 |
| |
890 |
| - | |
| 887 | + | |
891 | 888 |
| |
892 | 889 |
| |
893 | 890 |
| |
| |||
912 | 909 |
| |
913 | 910 |
| |
914 | 911 |
| |
915 |
| - | |
| 912 | + | |
916 | 913 |
| |
917 | 914 |
| |
918 | 915 |
| |
| |||
1008 | 1005 |
| |
1009 | 1006 |
| |
1010 | 1007 |
| |
| 1008 | + | |
1011 | 1009 |
| |
1012 | 1010 |
| |
1013 | 1011 |
| |
1014 |
| - | |
| 1012 | + | |
1015 | 1013 |
| |
1016 | 1014 |
| |
1017 | 1015 |
| |
| |||
1037 | 1035 |
| |
1038 | 1036 |
| |
1039 | 1037 |
| |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
1040 | 1049 |
| |
1041 | 1050 |
| |
1042 | 1051 |
| |
| |||
1218 | 1227 |
| |
1219 | 1228 |
| |
1220 | 1229 |
| |
1221 |
| - | |
1222 |
| - | |
1223 |
| - | |
1224 | 1230 |
| |
1225 | 1231 |
| |
1226 | 1232 |
| |
|
0 commit comments
Comments
(0)