On Wednesday, October 31, 2012 11:50 PM Palle Girgensohn wrote:
> This is an old problem, referred to in bug #4907:
>ALTER TABLE test ADD COLUMN foo INTEGER;
> SELECT * FROM test_func();
> - -- ERROR: wrong record type supplied in RETURN NEXT
> You have to run create or replace again to fix it when changing the
> schema. How come it fails? Is the return type "hardcoded" when the
> function is created?
I think it is because compiled body of function is created with that type of table. You will not see this problem if you reconnect or select from another new session.
> Is this very hard to fix?
Currently the compiled body is not discarded on DDL's, so I believe it is not a bug as per current implementation.
However it can be thought of as a new feature.
> IS there a suggested work-around?
Considering DDL's are used less often, you can see how feasible it is for you that after a DDL, you reconnect sessions which use functions.
I know this is not good workaround, but I am sorry nothing else comes to my mind for now.
Anybody else can think of any other better workarounds for this problem?
In response to
pgsql-hackers by date
|Next:||From: Michael Paquier||Date: 2012-11-01 04:31:34|
|Subject: Re: Synchronous commit not... synchronous?|
|Previous:||From: Peter Eisentraut||Date: 2012-11-01 04:05:33|
|Subject: Re: [COMMITTERS] pgsql: Preserve intermediate .c files in coverage