How to prevent query execution after exiting the \e editor in psql?
Don't add a semicolon (;) and you are fine. I quote the manual about the \e or \edit meta-command here:

The new contents of the query buffer are then re-parsed according to
the normal rules of psql, treating the whole buffer as a single line.
Any complete queries are immediately executed; that is, if the query
buffer contains or ends with a semicolon, everything up to that point
is executed and removed from the query buffer. Whatever remains in the
query buffer is redisplayed. Type semicolon or \g to send it, or
\r to cancel it by clearing the query buffer.

To be clear: only the last statement that is not terminated with a semicolon is not executed. To execute nothing at all, make sure there are no complete statements before the last statement. I.e. no semicolons at all.