Re: plan invalidation vs stored procedures

From: "Marko Kreen" <markokr(at)gmail(dot)com>
To: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
Cc: "Martin Pihlak" <martin(dot)pihlak(at)gmail(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>, "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plan invalidation vs stored procedures
Date: 2008-08-06 18:42:38
Message-ID: e51f66da0808061142t69bbb281jf10e1dde14a18e0f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8/6/08, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> On Wed, Aug 6, 2008 at 2:28 PM, Marko Kreen <markokr(at)gmail(dot)com> wrote:
> > On 8/6/08, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> >> On Wed, Aug 6, 2008 at 2:20 AM, Marko Kreen <markokr(at)gmail(dot)com> wrote:
> >> > But the main problem is that if the DROP/CREATE happens, the failure
> >> > mode is very nasty - you get permanent error on existing backends.
> >> > (Main case I'm talking about is functions calling other functions.)
> >> >
> >> > Some sorta recovery mode would be nice to have, it does not even
> >> > need function perfectly. Giving error once and then recover would
> >> > be better than requiring manual action from admin.
> >>
> >> sure -- this a known issue --, but the point is that there are not
> >> that many reasons why you have to drop/create a function if you are
> >> careful. hiding function prototypes is actually pretty powerful
> >> although you have to deal with creating the extra types.
> >
> > Um. If you are talking about about returning type defined by CREATE TYPE
> > then you are wrong as changing type requires DROP+CREATE for both type
> > and function.
>
> you missed the point...if your return type is a composite type that is
> backed by the table (CREATE TABLE, not CREATE TYPE), then you can
> 'alter' the type by altering the table. This can be done without full
> drop recreate of the function.

Yes, although I suspect it works by accident and can lead to crash
with creative use. (eg. plpgsql 'record' cache, any PL's rettype cache
are not invalidated when doing the ALTER TABLE)

But you missed my point: if you don't have functions backed by table,
the DROP+CREATE results in inappropriate behaviour that can be avoided.

--
marko

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Steve Mitchell 2008-08-06 19:13:40 ambulkinsert
Previous Message Asko Oja 2008-08-06 18:35:22 Re: plan invalidation vs stored procedures