Thread: Storing Queries
Aloha! PostgreSQL newbie here! Can I store SQL queries after I have started "psql <database>"? If so, how is it done? How do I recall the query to use it again? Thanks in advance. + John S. "Dilbert" Hambleton + Olson Library + Northern Michigan University + Marquette Michigan 49855 + NOTIS 6.5.0, GTO 6.5.0 + + Phone: 906-227-2741 + E-Mail: JHAMBLET@NMU.EDU + + Tempora mutantur, nos et mutamur in illis. +
"Hambleton, John" wrote: > > Aloha! > > PostgreSQL newbie here! > Can I store SQL queries after I have started "psql <database>"? > If so, how is it done? How do I recall the query to use it again? Aside from "up-arrow" to get previous lines in psql, I thought I saw something called pgbash somewhere that I thought might possibly have bash-like command-editing...you might checkout info at www.postgresql.org. Personally, I switch back and forth between interactive psql (for big ad hoc cut-n-paste queries from logs), psql -f filename (for long-standing repeated queries), and psql -c "query" (for quick ad hoc queries I may want to repeat via bash command-line editing... Cheers, Ed Loehr
> > Can I store SQL queries after I have started "psql <database>"? > > If so, how is it done? How do I recall the query to use it again? > > Aside from "up-arrow" to get previous lines in psql, I thought I saw > something called pgbash somewhere that I thought might possibly have > bash-like command-editing... I was curious, and dug this pgbash info up, in case others are interested... http://www.psn.co.jp/PostgreSQL/pgbash/index-e.html I'd be interested to know if people are using this and liking it... Cheers, Ed Loehr