Re: plan invalidation vs stored procedures

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Hannu Krosing" <hannu(at)krosing(dot)net>
Cc: "Asko Oja" <ascoja(at)gmail(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Martin Pihlak" <martin(dot)pihlak(at)gmail(dot)com>, "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plan invalidation vs stored procedures
Date: 2008-08-06 10:13:36
Message-ID: 162867790808060313v1e0fa6d0v852d5b2625732576@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2008/8/6 Hannu Krosing <hannu(at)krosing(dot)net>:
> On Tue, 2008-08-05 at 16:17 +0200, Pavel Stehule wrote:
>> 2008/8/5 Asko Oja <ascoja(at)gmail(dot)com>:
>> > postgres=# create or replace function pavel ( i_param text, status OUT int,
>> > status_text OUT text ) returns record as $$ select 200::int, 'ok'::text; $$
>> > language sql;
>> > CREATE FUNCTION
>> > postgres=# create or replace function pavel ( i_param text, status OUT int,
>> > status_text OUT text, more_text OUT text ) returns record as $$ select
>> > 200::int, 'ok'::text, 'tom'::text; $$ language sql;
>> > ERROR: cannot change return type of existing function
>> > DETAIL: Row type defined by OUT parameters is different.
>> > HINT: Use DROP FUNCTION first.
>> >
>> > On Tue, Aug 5, 2008 at 5:04 PM, Asko Oja <ascoja(at)gmail(dot)com> wrote:
>> >>
>> >> > This is simply a bad, wrong, stupid way to do it. Why do you not use
>> >> > CREATE OR REPLACE FUNCTION?
>> >> I totally agree we should get this fixed first :)
>> >>
>> >> postgres=# create or replace function pavel ( i_param text, status OUT
>> >> int, status_text OUT text ) returns record as $$ select 200::int,
>> >> 'ok'::text; $$ language sql;
>> >> ERROR: cannot change return type of existing function
>> >> HINT: Use DROP FUNCTION first.
>> >>
>>
>> you cannot change header of function. It's same as change C header of
>> function without complete recompilation.
>
> SQL is not C.
>
> You don't have to recompile the whole SQL database when you add columns
> to tables, so why should you need to do it, when you add a column to
> table-returning function ?
>

I thing, it's possible - but it's neccessary completly new dictionary
with dependencies (some dependencies are dynamic - polymorphic
functions) so it's dificult task.

Pavel

> --------------
> Hannu
>
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hitoshi Harada 2008-08-06 10:20:43 Re: Status of DISTINCT-by-hashing work
Previous Message Hannu Krosing 2008-08-06 09:15:21 Re: plan invalidation vs stored procedures