Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://serverfault.com/questions/415323/whats-a-convenient-way-to-execut-multiline-queries-in-postgres-using-ssh
- Query buffer!
- $ psql <your database name>
- Will take you to postgres's interactive terminal
- # \e
- for 'edit' will open up a query buffer. Write some query, like
- select now();
- within vim, nano, or whatever text editor you use. You're now in your favorite command-line text editor, and have all the multi-line capability you want.
- Save and quit your editor, and psql will run the query you just wrote.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement