Skip site navigation (1) Skip section navigation (2)

pl/pgSQL development environment

From: "Wm(dot)A(dot)Stafford" <stafford(at)marine(dot)rutgers(dot)edu>
To: pgsql-novice(at)postgresql(dot)org
Subject: pl/pgSQL development environment
Date: 2008-08-04 19:40:20
Message-ID: 48975B24.1050502@marine.rutgers.edu (view raw or flat)
Thread:
Lists: pgsql-novice
I have to convert a large number of Oracle pl/sql scripts to PostgreSQL 
8.3 pl/pgSQL and
I am stuck on the most basic part, how to do development with pl/pgSQL.

First of all what is the development model for pl/pgSQL development, i.e.
What is the  'industry standard' way edit, compile and test functions 
and procedures?
I don't see any examples of a complete process in the documentation.

I created the following  simple function as a first try:
CREATE OR REPLACE FUNCTION testfunc() RETURNS integer AS $$
BEGIN
          RAISE DEBUG 'Output from testfunc';
          return 2 ;
END ;
$$ LANGUAGE plpgsql;

Using both  psql and pgADMINIII I was able to load and execute this and 
see 2 as the output but I did not
see the output of the RAISE statement.  The RAISE output was not in the 
log file either.
Where does it go and can it be redirected to stdout?

Since pl/pgSQL does not have packages, what is the usual way of managing 
groups of related functions and procedures.  For example I have
a group pl/sql procedures that call functions from a library.  The 
library is one package.  The procedures that
use the library are in separate packages.

Thanks for any help and/or guidance,
Bill Stafford

Responses

pgsql-novice by date

Next:From: Richard BroersmaDate: 2008-08-04 19:59:48
Subject: Re: pl/pgSQL development environment
Previous:From: Frank BaxDate: 2008-08-02 11:39:16
Subject: Re: OIDS question

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group