Updated 5 January, 2023
In this post, I’m going to show you how to:
- ‘cancel’ yourself out of a buffer/command
- cancel a query
- ctrl+c yourself back to the shell/cmd prompt
Starting over on your query/script
Ctrl+C will kill you out of SQLcl completely if you’re in the editor. This is a bug on one of the components we’re using (JLINE), and we have a fix scheduled for SQLcl 19.2. But in the meantime, using the ESC key will provide you all the relief necessary.
You start typing, and at some point, you realize, there’s no fixing this, let’s just start over.
Again, we hope to have this working with Ctrl+C in version 19.2 of SQLcl.
Update: New Escape Sequence as of Version 21.2
Ctrl + G will get you out of the editor/buffer.
You can see this if you run ‘show keymap’ –
Cancelling a query
You’ve successfully submitted your query or anonymous block to the database. Now we want to cancel it. Ctrl+C will send that request.
Now at that point, it’s up to the jdbc driver and the database to decide how and WHEN to handle that request.
Here’s an example.
I’m tired of waiting just get me out of here already
Just hit ctrl+c, again.
Making this more transparent going forward
We also plan in version 19.2 to print status messages to the window. For example, when you send the query cancel, we’ll register that and let you know we’re working on it, so you don’t get frustrated and hit the button again.
I’m also told that in 19.2 with the new JLINE toys, we’ll be able to do some wicked-cool vi integration.
10 Comments
New 22.4 on MACOS 12 here. ESC nor working, just wondering if was designed also for MACOS or if we have different shortcut here.
Anyway, CTRL+C works OK, there is just still need for double pressing shortcut… And still missing some message that my script/query has been cancelled…
The new sequence on your Mac is Control+G
I’ve updated this post to reflect the changes, thanks for the heads-up!
On Windows 10 in the Windows Terminal under PowerShell the issue is still present.
Esc doesn’t work. Ctrl+C aborts sqlcl and exits to the shell prompt.
sqlcl version is 20.4.1.351.1718
What about in native CMD window? that works for me in 20.4 and WIN10.
Hmm, I also experience this problem. Environment: Windows 10 Pro 21H1, native CMD, SQLcl 20.4. If I press Ctrl-C on the “SQL>” prompt, in the SQL command editor or on an ACCEPT prompt, it kills SQLcl completely.
We fixed this in version 21.2.
When will set autotrace on be supported in SQLcl?
If you mean TRACEONLY, then not till at least version 20.2
otherwise autotrace already works
Bug still present in SQLcl 19.2.1.