Go back up a line in psql

Viewed 755

In psql, I want to go back up a line and edit my SQL from the line above. How would I accomplish this? I tried the up arrow to no avail. My only recourse is to exit psql and jump back in. enter image description here

For some context:

I want to go back to the line above and change SET dw1 = TRUE

I am ssh'd into the server using gitbash for windows

1 Answers

You haven't finished the command. Notice how the first line ends with =# while the second line ends with -#, which indicates that it's awaiting further text.

You need to end the command with a semicolon (;).

Once you're at a new line that starts with =# you can press up to retrieve the previous command.

Here's an example where I entered select 1<ENTER> followed by ;<ENTER> followed by <UP>:

db=# select 1
db-# ;
 ?column?
----------
        1
(1 row)

db=# select 1
;
Related