Re: Tab completion for SET TimeZone
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2022-03-18T18:53:04Z
Lists: pgsql-hackers
Attachments
- v5-0001-Add-tab-completion-for-SET-TimeZone-TO.patch (text/x-diff) patch v5-0001
=?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= <ilmari@ilmari.org> writes: > I just realised there's no point in the subselect when I'm not applying > the same function in the WHERE and the SELECT, so here's an updated > version that simplifies that. It also fixes a typo in the commit > message. This doesn't work right for me under libedit -- it will correctly complete "am<TAB>" to "'America/", but then it fails to complete anything past that. The reason seems to be that once we have a leading single quote, libedit will include that in the text passed to future completion attempts, while readline won't. I ended up needing three query variants, as attached (bikeshedding welcome). I think the reason the COMPLETE_WITH_ENUM_VALUE macro doesn't look similar is that it hasn't made an attempt to work with input that the user didn't quote --- that is, if you type alter type planets rename value ur<TAB> it just fails to match anything, instead of providing "'uranus'". Should we upgrade that likewise? Not sure it's worth the trouble though; I think COMPLETE_WITH_ENUM_VALUE is there more as a finger exercise than because people use it regularly. I added a regression test case too. regards, tom lane
Commits
-
psql: handle tab completion of timezone names after "SET TIMEZONE TO".
- 7fa3db367986 15.0 landed