Thread: PL/pgsql questions..

PL/pgsql questions..

From
tveith@heaven.oeh.univie.ac.at
Date:
Hi,

I'm new on this list and i'm using postgreSQL 6.5. I think it has done a
great step towards usability since the days when i last took a look at it
(postgres 95).. congrats, you did a very good job.

One thing which I think is really important is PL/pgsql.. I carefully read
the bit of information which is available, but thats not very much..

I have 2 questions.. first, can you point me to some information about
this topic which i maybe have missed?

second, take this procedure from an informix database:

create procedure list_abteilung (p_mandnr smallint) returning smallint, char(30);

define v_abtnr smallint;
define v_abtbez char(30);

foreach select a.abtnr, a.abtbez into   v_abtnr, v_abtbez from   gm_abt a, gm_maabt m where  a.abtnr=m.abtnr   and
m.gesperrt<>1  and  a.gesperrt<>1   and  m.mandant=p_mandnr return v_abtnr, v_abtbez with resume;
 
end foreach;

end procedure;

i will try to explain the two main features of this procedure: foreach is
a loop which iterates through the resultset of the query; return with
resume returns a row to the caller and then continues with the procedure.

of course i know that this particular procedure could be easily
substituted by a view; i just took it because it is short and
demonstrates this two important features.

so my question is, does PG/plsql support this, if so how, and if not, is
it planned to be supported in the near future?

best regards,
Thomas Veith 




Re: [SQL] PL/pgsql questions..

From
jwieck@debis.com (Jan Wieck)
Date:
Thomas Veith wrote:
>
> One thing which I think is really important is PL/pgsql.. I carefully read
> the bit of information which is available, but thats not very much..

    Tnx

>
> I have 2 questions.. first, can you point me to some information about
> this topic which i maybe have missed?

    Maybe you missed the docs in the programmers manual?

>
> second, take this procedure from an informix database:
>
> [...]
>
> so my question is, does PG/plsql support this, if so how, and if not, is
> it planned to be supported in the near future?

    Functions  in procedural languages (PL/Tcl, PL/pgSQL) inherit
    the  same  restrictions  C   language   functions   have   in
    PostgreSQL.  One  of  them  I  hate  most is that they cannot
    return  set  results.   Thus  "RETURN  ...  AND  RESUME"   is
    currently  not  supported.  It  requires major changes to the
    function manager and executor.

    The time I expect it is not that near in future I would  like
    it.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #