On Tue, Apr 9, 2024 at 6:18 PM Robert Haas <robertmh...@gmail.com> wrote: > On Thu, Apr 4, 2024 at 10:38 PM Michael Paquier <mich...@paquier.xyz> wrote: > > > It kind of looks like a libedit bug, but maybe we should dig more > > > deeply. I felt itchy about 927332b95e77 removing '{' from the > > > WORD_BREAKS set, and wondered exactly how that would change readline's > > > behavior. But even if that somehow accounts for the extra backslash > > > before '{', it's not clear how it could lead to '?' and '}' also > > > getting backslashed. > > > > I don't have a clear idea, either. I also feel uneasy about > > 927332b95e77 and its change of WORD_BREAKS, but this has the smell > > of a bug from an outdated libedit version. > > I too felt uneasy about that commit, for the same reason. However, > there is a justification for the change in the commit message which is > not obviously wrong, namely that ":{?name} is the only psql syntax > using the '{' sign". And in fact, SQL basically doesn't use '{' for > anything, either. We do see { showing up inside of quoted strings, for > arrays or JSON, but I would guess that the word-break characters > aren't going to affect behavior within a quoted string. So it still > seems like it should be OK? Another thing that makes me think that my > unease may be unfounded is that the matching character '}' isn't in > WORD_BREAKS either, and I would have thought that if we needed one > we'd need both.
FWIW, the default value of rl_basic_word_break_characters [1] has '{' but doesn't have '}'. The documentation says that this should "break words for completion in Bash". But I failed to find an explanation why this should be so for Bash. As you correctly get, my idea was that our SQL isn't not heavily using '{' unlike Bash. > But does anyone else have a more specific reason for thinking that > this might be a problem? I don't particularly object against reverting this commit, but I think we should get to the bottom of this first. Otherwise there is no warranty to not run into the same problem again. Links. 1. https://tiswww.case.edu/php/chet/readline/readline.html#index-rl_005fbasic_005fword_005fbreak_005fcharacters ------ Regards, Alexander Korotkov