Re: Stored Procedures and Functions - Mailing list pgsql-general

From PFC
Subject Re: Stored Procedures and Functions
Date
Msg-id op.ttayv6e4cigqcu@apollo13
Whole thread Raw
In response to Re: Stored Procedures and Functions  ("Leif B. Kristensen" <leif@solumslekt.org>)
List pgsql-general

    MySQL supports procedures and functions.

    Functions can return results but cannot update the database.
    Procedures can update the database but cannot return results.

    However :
    - a function can call a procedure that updates the database !
    - a procedure can return result through OUT parameters !

    It's a friggin mess. In pgsql, if you want, a STABLE or IMMUTABLE
procedure is a function since it is repeatable : it will always return the
same results with the same parameters, and has no side-effects. This is
the definition of a function.

    It is better not to draw useless lines in the ground with huge "don't
walk over this line" stickers. People will always find a way around.
Better offer features that users need.


>> Is it true that postgres doesn't have a notion of Stored Procedures
>> and functions is what it has instead?
>> RDBMS like Sql Server supports both stored procedures and functions.
>> So I was wondering what is the difference between a Stored Procedure
>> and a function.
>
> Pascal has functions and procedures. C has only functions. That doesn't
> say anything about the relative usability of each language. Those are
> just names.



pgsql-general by date:

Previous
From: "Pavel Stehule"
Date:
Subject: Re: Stored Procedures and Functions
Next
From: "Dawid Kuroczko"
Date:
Subject: Re: Transactional DDL