Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Better way to write PL/pgSQL?

Is there a decent IDE-like tool for writing and debugging PL/pgSQL functions, e.g. for writing stored procedures?

I find it an exercise in frustration using pgAdmin III, because the error messages are often deeply cryptic and things have a habit of failing in mysterious ways.

like image 889
Rob Avatar asked Jul 07 '09 20:07

Rob


2 Answers

Those products list PL/pgSQL Debugger as a feature: PostgreSQL Maestro, EMS SQL Manager for PostgreSQL, Postgres Plus® Advanced Server.

I haven't used any of them though.

like image 34
Milen A. Radev Avatar answered Sep 29 '22 01:09

Milen A. Radev


I using classic programmer editor like emacs, vi, eclipse. I have one rule: store every code to file. Classic editors are usually better tools for editing code than DBA specialised IDE managers. psql has important command \i file for import edited file to PostgreSQL.

p.s. Emacs has very nice support for sql and is very well integrated with Postgres.

My second rule - don't use GUI managers for editing stored procedures. You cannot comment code, you have not control over sources. You cannot put related procedures to one file. IDE allows editing only isolated procedures, and it is very bad - for maintenance more than ten procedures.

like image 61
Pavel Stehule Avatar answered Sep 29 '22 03:09

Pavel Stehule