Re: Changing PL/pgSQL triggers

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "James Orr" <james(at)lrgmail(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Changing PL/pgSQL triggers
Date: 2001-06-21 19:31:44
Message-ID: web-75462@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Mark Hamby 2001-06-21 20:50:58 RE: Select most recent record?
Previous Message Marc Sherman 2001-06-21 19:27:03 RE: Select most recent record?