Re: "stored procedures"

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Merlin Moncure" <mmoncure(at)gmail(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Josh Berkus" <josh(at)agliodbs(dot)com>,<pgsql-hackers(at)postgresql(dot)org>
Subject: Re: "stored procedures"
Date: 2011-04-22 15:03:10
Message-ID: 4DB1525E020000250003CBB1@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

>> You can't have arithmetic, comparisons, or much of anything
>> outside a transaction with plpgsql. That model just plain
>> doesn't work for this purpose, I think. You really want a
>> control language that's independent of the SQL engine, and for
>> better or worse plpgsql is built inside that engine.
>
> I'm arguing against a separate language, or at least questioning
> if plpgsql truly can't be run without an outer transaction
> context. Just because a transaction isn't set up on procedure
> invocation, doesn't mean you can't set them up to do things in the
> procedure?

Right -- I don't think anyone has suggested that transactions can't
be started and ended "within" a SP. And I have argued that if a SP
is called while a transaction is active, it runs within the context
of that transaction.

> It wouldn't bother me in the lest that if in plpgsql procedures if
> you had to set up and tear down a transaction on every line.

+1

> You can always dip into a function if/when you need the turbo
> boost.

Or BEGIN a transaction.

> Setting up a new control language implies that postgres needs to
> know the procedure language textually so it can read off a line
> and do something with it. I don't like this restriction --
> wouldn't it be better if the current crop of language handlers
> could run procedures without major changes? C functions with SPI?
> However it's internally implemented, the more userland mindspace
> recovered for use of writing procedures the better off we are.

+1

-Kevin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Leonardo Francalanci 2011-04-22 15:08:36 Re: What Index Access Method Functions are really needed?
Previous Message Merlin Moncure 2011-04-22 14:56:13 Re: "stored procedures"