Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Is there an option that can change the "exit external editor -> query runs automatically" behaviour of the psql \e switch ? (Other than intentionally mangling the query syntax).

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Don't add a semicolon (;)and you are fine. I quote the manual about the \e or \edit meta-command here:

...if the query ends with (or contains) a semicolon, it is immediately executed. Otherwise it will merely wait in the query buffer; type semicolon or \g to send it, or \r to cancel.

share|improve this answer

You can always prefix the query with the postgres comment string:

--select foo from bar;

and the query will not run but will be available in the psql deadline history buffer for editing.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.