This month’s PGSQL Phriday #006 question has a very easy answer for me:
\e [filename]
\e
(without a filename) lets you edit the most-recently run query and is very helpful for fixing typos, adding/removing columns, etc.
If you like to use \i
to run queries from an external file (and who doesn’t!), use \e [filename]
.
I learned about \e
from David Wheeler in the early days of PGXPUG – up to that point I’d employed the time-honored tradition of copying & pasting my queries out of a text editor, so this stands out as a life-changing moment.