rococo
rococo

Reputation: 2657

Postgres Command line - clear/delete a query that I was in the middle of typing

Is there a way to quickly delete an entire query that I've been typing?

To clarify, this would be a query I'm still typing, not something that's currently running.

For example in bash, you can hit CTRL+C and it kills your current line, like:

$ typing some comman<CTRL-C>

After pressing CTRL+C it stops the previous stuff I have typed without executing.

It's just a thing I'm used to doing for quickly switching trains of thought ("oh what if I do this instead of this?"), but CTRL+C in the postgres terminal just terminates the process.

Upvotes: 6

Views: 3960

Answers (2)

Thorvald
Thorvald

Reputation: 665

As of 2024 on windows, instead of pressing ctrl + c as you just mentioned, instead use CTRl + Backspace. This will delete the row. This replaced CTRL + C for me when working in the psql shell.

Upvotes: 0

clemens
clemens

Reputation: 17712

Aa alternative to Ctrl+C is Ctrl+ACtrl+K. While Ctrl+A moves the cursor to the beginning of the current line, Ctrl+K deletes all characters after the cursor.

This can be used in bash or many other UNIX commands, too.

Upvotes: 3

Related Questions