forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitcb94305
committed
psql: Reset query buffer of \e, \ef and \ev on error
If any of these commands fail during editing or pre-processing, thecommand stored in the query buffer would remain around without beingexecuted immediately as PSQL_CMD_ERROR is returned as status. The nextcommand provided by the user would run it, likely causing failures asthis could include silently some of the contents generated automaticallyfor views or functions.The problems would be different depending on the psql meta-command used:- For \ev and \ef, some errors can happen in a predictable way whiledoing an object lookup or while creating an object command. A failurewhile editing is equally problematic, but the class of failureshappening in the code path of do_edit() are unlikely. The query resetis kept in exec_command_ef_ev() as a query may be unchanged.- For \e, error can happen while editing.In both cases, the query buffer is reset on error for an incorrect filenumber provided, whose value check is done before filling up the querybuffer.This is a slight change of behavior compared to the past for some of thepredictable error patterns for \ev and \ef, so for now I have made thechoice to not backpatch this commit (argument particularly available forv11 that's going to be EOL'd soon). Perhaps this could be revisitedlater depending on the feedback of this new behavior.Author: Ryoga Yoshida, Michael PaquierReviewed-by: Aleksander Alekseev, Kyotaro HoriguchiDiscussion:https://postgr.es/m/01419622d84ef093fd4fe585520bf03c@oss.nttdata.com1 parent9bfd44b commitcb94305
1 file changed
+15
-0
lines changedLines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1127 | 1127 |
| |
1128 | 1128 |
| |
1129 | 1129 |
| |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
1130 | 1138 |
| |
1131 | 1139 |
| |
1132 | 1140 |
| |
| |||
1239 | 1247 |
| |
1240 | 1248 |
| |
1241 | 1249 |
| |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
1242 | 1257 |
| |
1243 | 1258 |
| |
1244 | 1259 |
| |
|
0 commit comments
Comments
(0)