5 ms·
For running queries that modify data, I will start with BEGIN, run the query, maybe run some checks, then COMMIT or ROLLBACK depending on if it did what I hoped
by thdc 4y ago
For running queries that modify data, I will start with BEGIN, run the query, maybe run some checks, then COMMIT or ROLLBACK depending on if it did what I hoped it would do.
Are there any downsides to that outside of more typing?
Ah I see the `–i-am-a-dummy` also affects queries with large result set sizes.
- lordgilman 4y ago(Author here) I think the purpose of the large result limiting is to avoid swamping the terminal with output. The whole set of --i-am-a-dummy features is to give a saving chance to the hackers who are typing away without any forethought into a prompt in autocommit mode. Using transactions, copy and pasting complete queries, having your coworker double-check your work etc give you enough foresight that you'll not have a need for it.
- doctor_eval 4y agoI agree with the GP - rename “commit” to “save” if you have to, disable autocommit, and use a paginator. Voila! Dummy mode. I’m definitely not a PG dummy but that’s what I do anyway.
- silverlyra 4y agoYour comment led me to realize that I could run psql with -v AUTOCOMMIT=0 (or add that to ~/.psqlrc) to achieve most of the safety net I've been wanting. My fear has been forgetting the BEGIN.