aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonfuncs.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2023-09-20 09:26:15 +0900
committerMichael Paquier <michael@paquier.xyz>2023-09-20 09:26:15 +0900
commitcb943054f3f6d67c858dd63192afaa488f8cb51e (patch)
tree0656fdd441fb17fd12209d9885ca2f7ba9a55964 /src/backend/utils/adt/jsonfuncs.c
parent9bfd44bbde4261181bf94738f3b041c629c65a7e (diff)
downloadpostgresql-cb943054f3f6d67c858dd63192afaa488f8cb51e.tar.gz
postgresql-cb943054f3f6d67c858dd63192afaa488f8cb51e.zip
psql: Reset query buffer of \e, \ef and \ev on error
If any of these commands fail during editing or pre-processing, the command stored in the query buffer would remain around without being executed immediately as PSQL_CMD_ERROR is returned as status. The next command provided by the user would run it, likely causing failures as this could include silently some of the contents generated automatically for 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 while doing an object lookup or while creating an object command. A failure while editing is equally problematic, but the class of failures happening in the code path of do_edit() are unlikely. The query reset is 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 file number provided, whose value check is done before filling up the query buffer. This is a slight change of behavior compared to the past for some of the predictable error patterns for \ev and \ef, so for now I have made the choice to not backpatch this commit (argument particularly available for v11 that's going to be EOL'd soon). Perhaps this could be revisited later depending on the feedback of this new behavior. Author: Ryoga Yoshida, Michael Paquier Reviewed-by: Aleksander Alekseev, Kyotaro Horiguchi Discussion: https://postgr.es/m/01419622d84ef093fd4fe585520bf03c@oss.nttdata.com
Diffstat (limited to 'src/backend/utils/adt/jsonfuncs.c')
0 files changed, 0 insertions, 0 deletions