Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build a Postgres IDE in Emacs

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. 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?

like image 702
User1 Avatar asked Dec 16 '10 00:12

User1


People also ask

Does PostgreSQL have an IDE?

PostgreSQL is one of the most popular open source free database. There are over 100 different IDE available to manage and develop PostgreSQL. The team at PostgreSQL has created a page with all the major IDE available on the web.

Is there a PostgreSQL workbench?

Install SQL Workbench for Postgres. SQL Workbench helps you manage different database systems without the need to master each of their proprietary tools in turn. Installing SQL Workbench is a straightforward process that can be completed in a few short steps.

Is there a phpMyAdmin for PostgreSQL?

The answer is no. There's no phpMyAdmin for PostgreSQL. If that's what you want, then try TablePlus. TablePlus is a native database client that offers GUI tools to develop, manage and maintain multiple databases simultaneously. Native build for Mac, and Windows.

What is Createdb in PostgreSQL?

createdb creates a new PostgreSQL database. Normally, the database user who executes this command becomes the owner of the new database. However, a different owner can be specified via the -O option, if the executing user has appropriate privileges. createdb is a wrapper around the SQL command CREATE DATABASE .


1 Answers

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.

like image 92
Jeremiah Peschka Avatar answered Sep 18 '22 06:09

Jeremiah Peschka