Re: Changing PL/pgSQL triggers - Mailing list pgsql-sql

From Josh Berkus
Subject Re: Changing PL/pgSQL triggers
Date
Msg-id web-75462@davinci.ethosmedia.com
Whole thread Raw
In response to Changing PL/pgSQL triggers  ("James Orr" <james@lrgmail.com>)
Responses Re: Changing PL/pgSQL triggers
List pgsql-sql
James,

> What's the easiest way to modify or view a function written in
> PL/pgSQL?  I've been using pg_dump to get the original function, then
> dropping and creating the function and trigger after making a change.
> Is there an easier way?

Well, if you're on Win32 or on Linux, you can install PGAccess (link
from postgresql.org).  PGAccess has an OK function editor, although it
doesn't support cut-and-paste on Xwindows and I've found a few bugs with
large and complex functions.

Me, I write lots and lots of PL/pgSQL functions.  I've found the easiest
way to be (I'm on SuSE 7.0/KDE2.1):

1. Create text file, and write and edit function in KEdit.

2. Save text file.

3. Load function using \i in PSQL.

4. Test function.  FInd bug(s).

5. Re-edit function using Kedit.  Add DROP FUNCTION command at
beginning.

6. Re-load function using \i in PSQL.

7. Repeat from 4 until function is debugged.

It sounds like a lot of steps, but really it goes quickly.  Plus it
allows you to save lots of intermediate versions of functions.

-Josh


______AGLIO DATABASE SOLUTIONS___________________________                                      Josh Berkus Complete
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


pgsql-sql by date:

Previous
From: "Marc Sherman"
Date:
Subject: RE: Select most recent record?
Next
From: Martín Marqués
Date:
Subject: case, new column not found