Re: Patch: plan invalidation vs stored procedures

From: Martin Pihlak <martin(dot)pihlak(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch: plan invalidation vs stored procedures
Date: 2008-08-15 11:13:59
Message-ID: 48A564F7.50908@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Martin Pihlak <martin(dot)pihlak(at)gmail(dot)com> writes:
>> Changing statement result type is also currently prohibited in
>> StorePreparedStatement. There maybe good reasons for this,
>
> How about "the SQL spec says so"?
>
> Admittedly, it's a bit of a jump from views to prepared statements,
> but the spec is perfectly clear that altering a table doesn't alter
> any views dependent on it: SQL99 11.11 <add column definition> saith

As you said it is a bit of a jump ... For one thing view definitions are
persistent whereas statements are bound to be replanned sooner or later -
reconnects etc. Disallowing replanning after invalidation just postpones
it and meanwhile the cached plans are left unusable ("cached plan must not
change result"). IMHO the problem should be left for the application to handle.
Because this is where it will end up anyway.

Attached is a patch that implements plan invalidation on function DROP,
REPLACE and ALTER. Function oids used by the query are collected in analyze phase
and stored in PlannedStmt. Only plans that reference the altered function are
invalidated. The patch also enables replanning on result set change.

regards,
Martin

Attachment Content-Type Size
plan-inval-proc.patch text/x-diff 23.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message alexander lunyov 2008-08-15 11:26:52 Re: migrate data 6.5.3 -> 8.3.1
Previous Message Andreas Pflug 2008-08-15 10:56:13 Re: migrate data 6.5.3 -> 8.3.1