Re: Bug fix for psql's meta-command \ev

2023-09-19 Thread Ryoga Yoshida
On 2023-09-20 09:32, Michael Paquier wrote: Actually there was a bit more to it in the presence of \e, that could also get some unpredictible behaviors if some errors happen while editing a query, which is something unlikely, still leads to strange behaviors on failure injections. I was consider

Re: Bug fix for psql's meta-command \ev

2023-09-19 Thread Michael Paquier
On Tue, Sep 19, 2023 at 01:23:54PM +0300, Aleksander Alekseev wrote: > You are right, I missed it. Your patch is correct while the original > one is not quite so. Actually there was a bit more to it in the presence of \e, that could also get some unpredictible behaviors if some errors happen while

Re: Bug fix for psql's meta-command \ev

2023-09-19 Thread Aleksander Alekseev
Hi Michael, > The patch looks incorrect to me. In case you've not noticed, we'd > still have the same problem if do_edit() fails [...] You are right, I missed it. Your patch is correct while the original one is not quite so. -- Best regards, Aleksander Alekseev

Re: Bug fix for psql's meta-command \ev

2023-09-19 Thread Ryoga Yoshida
On 2023-09-19 15:29, Ryoga Yoshida wrote: You can see attached file. I didn't notice that Michael attached the patch file. Just ignore my file. I apologize for the inconvenience. Ryoga Yoshida

Re: Bug fix for psql's meta-command \ev

2023-09-18 Thread Ryoga Yoshida
On 2023-09-19 12:53, Michael Paquier wrote: Adding a comment looks important to me once we consider the edit as a path that can fail and the edited query is only executed then reset when we have PSQL_CMD_NEWEDIT as status. I would suggest the patch attached instead, taking care of the error case

Re: Bug fix for psql's meta-command \ev

2023-09-18 Thread Michael Paquier
On Mon, Sep 18, 2023 at 06:54:50PM +0300, Aleksander Alekseev wrote: > I tested the patch and it LGTM too. I don't have a strong opinion on > whether we should bother with a comment or not. > > As a side note I wonder whether we shouldn't assume that query_buf is > always properly initialized else

Re: Bug fix for psql's meta-command \ev

2023-09-18 Thread Aleksander Alekseev
Hi, I came across the patch since it was marked as "Needs review" (and then I realized that I mistakenly opened the upcoming commit fest, not the current one...). > Good catch! I agree to this. > > > This problem can be resolved by resetting the query buffer on > > error. You can see the attached

Re: Bug fix for psql's meta-command \ev

2023-09-14 Thread Kyotaro Horiguchi
At Fri, 15 Sep 2023 11:37:46 +0900, Ryoga Yoshida wrote in > I think this is a bug in psql's \ev meta-command. Even when \ev fails, > it should not leave the garbage string in psql's query buffer and the > following query should be completed successfully. Good catch! I agree to this. > This pr

Re: Bug fix for psql's meta-command \ev

2023-09-14 Thread Michael Paquier
On Fri, Sep 15, 2023 at 11:37:46AM +0900, Ryoga Yoshida wrote: > I think this is a bug in psql's \ev meta-command. Even when \ev fails, it > should not leave the garbage string in psql's query buffer and the following > query should be completed successfully. Right. Good catch. Will look at that

Bug fix for psql's meta-command \ev

2023-09-14 Thread Ryoga Yoshida
Hi, When a table name is specified as the first argument of \ev meta-command, it reports the error message, the prompt string becomes "-#" and then the following valid query fails because the psql's query buffer contains the garbage string generated by failure of \ev. Please see the following