Re: Difference between function and procedure?

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Anastasios Hatzis" <ahatzis(at)gmx(dot)net>
Cc: "PostgreSQL general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Difference between function and procedure?
Date: 2006-07-19 17:41:32
Message-ID: b42b73150607191041h2e514a22g85bca11e113cbc1d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/19/06, Anastasios Hatzis <ahatzis(at)gmx(dot)net> wrote:
> Hi,
>
> I'm diving more into depth of the features outside the typical table
> stuff, which I usually need.
>
> I wrote a trigger that fires a function written in PL/Python, both works
> fine so far.
>
> But as I browsed my database via pgAdmin3 I recognized that there is
> also 'Procedures' under 'public' available, but empty yet. Trying to
> create a procedure resulted in the same SQL statement like creating a
> function (CREATE FUNCTION ...). I couldn't see any difference. Also
> didn't find in the PostgreSQL manual if there is a difference between
> functions and procedures. Are there any at all?

there are differences. PostgreSQL only really supports functions and
on the lists they are used interchangably. on the -hacker list about
a year back there was a good discussion about implementing true SP and
why they would be needed.

mainly, SP are not externally transactional, making them useful for
maintenance type work, such as vacuum (cant be run from inside a
transaction) or multiple statement data load via 'copy' commands.

i thnk (not sure) that SP can not be inlined into queries like
functions. this would be an important distinction.

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pratik Shukla 2006-07-19 17:54:07 Linking Tables from 2 databases
Previous Message Tom Lane 2006-07-19 17:40:58 Re: Problem creating a function