forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitcd69ec6
committed
Improve psql's tab completion for filenames.
The Readline library contains a fair amount of knowledge about how totab-complete filenames, but it turns out that that doesn't work too wellunless we follow its expectation that we use its filename quoting hooksto quote and de-quote filenames. We were trying to do such quote handlingwithin complete_from_files(), and that's still what we have to do if we'reusing libedit, which lacks those hooks. But for Readline, it works a lotbetter if we tell Readline that single-quote is a quoting character andthen provide hooks that know the details of the quoting rules for SQLand psql meta-commands.Hence, resurrect the quoting hook functions that existed in the originalversion of tab-complete.c (and were disabled by commitf6689a3 becausethey "didn't work so well yet"), and whack on them until they do seem towork well.Notably, this fixes bug #16059 from Steven Winfield, who pointed outthat the previous coding would strip quote marks from filenames in SQLCOPY commands, even though they're syntactically necessary there.Now, we not only don't do that, but we'll add a quote mark when youtab-complete, even if you didn't type one.Getting this to work across a range of libedit versions (and, to alesser extent, libreadline versions) was depressingly difficult.It will be interesting to see whether the new regression test casespass everywhere in the buildfarm.Some future patch might try to handle quoted SQL identifiers withsimilar explicit quoting/dequoting logic, but that's for another day.Patch by me, reviewed by Peter Eisentraut.Discussion:https://postgr.es/m/16059-8836946734c02b84@postgresql.org1 parent5ba40b6 commitcd69ec6
File tree
9 files changed
+438
-55
lines changed- config
- src
- bin/psql
- t
- include
- tools/msvc
9 files changed
+438
-55
lines changedLines changed: 45 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
209 | 209 |
| |
210 | 210 |
| |
211 | 211 |
| |
212 |
| - | |
213 |
| - | |
| 212 | + | |
| 213 | + | |
214 | 214 |
| |
| 215 | + | |
215 | 216 |
| |
216 |
| - | |
| 217 | + | |
217 | 218 |
| |
218 | 219 |
| |
219 |
| - | |
220 |
| - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
221 | 224 |
| |
222 |
| - | |
| 225 | + | |
223 | 226 |
| |
224 | 227 |
| |
225 | 228 |
| |
| |||
228 | 231 |
| |
229 | 232 |
| |
230 | 233 |
| |
231 |
| - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
232 | 270 |
| |
233 | 271 |
| |
234 | 272 |
| |
|
Lines changed: 84 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
16316 | 16316 |
| |
16317 | 16317 |
| |
16318 | 16318 |
| |
16319 |
| - | |
16320 |
| - | |
| 16319 | + | |
| 16320 | + | |
| 16321 | + | |
| 16322 | + | |
16321 | 16323 |
| |
16322 |
| - | |
| 16324 | + | |
16323 | 16325 |
| |
16324 | 16326 |
| |
16325 | 16327 |
| |
| |||
16345 | 16347 |
| |
16346 | 16348 |
| |
16347 | 16349 |
| |
| 16350 | + | |
| 16351 | + | |
| 16352 | + | |
| 16353 | + | |
| 16354 | + | |
| 16355 | + | |
| 16356 | + | |
| 16357 | + | |
| 16358 | + | |
| 16359 | + | |
| 16360 | + | |
| 16361 | + | |
| 16362 | + | |
| 16363 | + | |
| 16364 | + | |
| 16365 | + | |
| 16366 | + | |
| 16367 | + | |
| 16368 | + | |
| 16369 | + | |
| 16370 | + | |
| 16371 | + | |
| 16372 | + | |
| 16373 | + | |
| 16374 | + | |
| 16375 | + | |
| 16376 | + | |
| 16377 | + | |
| 16378 | + | |
| 16379 | + | |
| 16380 | + | |
| 16381 | + | |
| 16382 | + | |
| 16383 | + | |
| 16384 | + | |
| 16385 | + | |
| 16386 | + | |
| 16387 | + | |
| 16388 | + | |
| 16389 | + | |
| 16390 | + | |
| 16391 | + | |
| 16392 | + | |
| 16393 | + | |
| 16394 | + | |
| 16395 | + | |
| 16396 | + | |
| 16397 | + | |
| 16398 | + | |
| 16399 | + | |
| 16400 | + | |
| 16401 | + | |
| 16402 | + | |
| 16403 | + | |
| 16404 | + | |
| 16405 | + | |
| 16406 | + | |
| 16407 | + | |
| 16408 | + | |
| 16409 | + | |
| 16410 | + | |
| 16411 | + | |
| 16412 | + | |
| 16413 | + | |
| 16414 | + | |
| 16415 | + | |
| 16416 | + | |
| 16417 | + | |
| 16418 | + | |
| 16419 | + | |
| 16420 | + | |
| 16421 | + | |
| 16422 | + | |
| 16423 | + | |
| 16424 | + | |
| 16425 | + | |
| 16426 | + | |
| 16427 | + | |
| 16428 | + | |
16348 | 16429 |
| |
16349 | 16430 |
| |
16350 | 16431 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1874 | 1874 |
| |
1875 | 1875 |
| |
1876 | 1876 |
| |
1877 |
| - | |
| 1877 | + | |
1878 | 1878 |
| |
1879 | 1879 |
| |
1880 | 1880 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
282 | 282 |
| |
283 | 283 |
| |
284 | 284 |
| |
| 285 | + | |
285 | 286 |
| |
286 | 287 |
| |
287 | 288 |
| |
288 | 289 |
| |
289 | 290 |
| |
290 | 291 |
| |
291 | 292 |
| |
292 |
| - | |
| 293 | + | |
| 294 | + | |
293 | 295 |
| |
294 | 296 |
| |
295 | 297 |
| |
296 | 298 |
| |
297 |
| - | |
| 299 | + | |
298 | 300 |
| |
299 | 301 |
| |
300 | 302 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
25 |
| - | |
| 25 | + | |
| 26 | + | |
26 | 27 |
| |
27 | 28 |
|
Lines changed: 74 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
63 | 87 |
| |
64 | 88 |
| |
65 | 89 |
| |
| |||
104 | 128 |
| |
105 | 129 |
| |
106 | 130 |
| |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
107 | 140 |
| |
108 | 141 |
| |
109 | 142 |
| |
| |||
142 | 175 |
| |
143 | 176 |
| |
144 | 177 |
| |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
145 | 219 |
| |
146 | 220 |
| |
147 | 221 |
| |
|
0 commit comments
Comments
(0)