I noticed emacs has a sql-postgres
mode. It's a good start, but my needs are very different. I usually have a large SQL file that I am editing and I want to "run" it on the database. I would like to edit my code in Emacs, not PG Admin. However, I am a bit more picky on how I see the results. I would rather not see a new Emacs buffer since Emacs doesn't really do grids that well.开发者_JAVA百科 I was thinking of popping up some program that could show me the results in a very pretty, interactive view. Maybe something like openoffice or some custom piece of code.
I think the best method is to hack together a makefile that will automatically run the sql file against postgres (which may even allow me to jump to any errors). Then, if the script is successful, possible pipe the results to some program. But which program and how can I get those results to it?
Please let me know if there is a better way. I don't want some commercial software or Windows-only freeware. I'd prefer OpenSource. Any advice?
You could use psql on the command line and set emacs to be your editor of choice. Whenever you type \e
in psql, it will open your editor of choice. Grid display + emacs and there's no need to write any code.
精彩评论