Re: fix: plpgsql: return query and dropped columns problem

From: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Sergey Burladyan <eshkinkot(at)gmail(dot)com>, Michael Tenenbaum <michael(at)strategic-techs(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: fix: plpgsql: return query and dropped columns problem
Date: 2009-07-20 16:34:27
Message-ID: 3073cc9b0907200934s586980ecy6e56e79eed6c867f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Mon, Jul 20, 2009 at 10:09 AM, Alvaro
Herrera<alvherre(at)commandprompt(dot)com> wrote:
> Tom Lane escribió:
>> Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec> writes:
>> > this one applies, compiles and it actually fixes the bug...
>>
>> And introduces a bunch of new ones.  Surely you don't think that version
>> of compatible_tupdesc() is good enough.
>
> Getting rid of the check on natts was "ungood" ... it needs to compare
> the number of undropped columns of both tupdescs.
>

ah! ok, i see... i will mark the patch as "waiting on author" and then
will try to fix it myself unless pavel wants to do it himself

create table test_tbl (a int, b date, c int);

create function trg_ins_test_tbl() returns trigger as $$
begin
new.c = 100;
return new;
end;
$$ language plpgsql;

create trigger trg_test_tbl before insert on test_tbl for each row
execute procedure trg_ins_test_tbl();
insert into test_tbl(a, b) select i, current_date + i from
generate_series(7, 9) as i;
alter table test_tbl add column z text;
alter table test_tbl drop column z;
alter table test_tbl add column z text;

insert into test_tbl(a, b) select i, current_date + i from
generate_series(7, 9) as i;
ERROR: returned row structure does not match the structure of the
triggering table
DETAIL: Returned type text does not match expected type text in column "z".
CONTEXT: PL/pgSQL function "trg_ins_test_tbl" during function exit
STATEMENT: insert into test_tbl(a, b) select i, current_date + i from
generate_series(7, 9) as i;

--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Mathieu Fenniak 2009-07-20 19:47:03 Bug 4906 -- Left join of subselect incorrect
Previous Message Alvaro Herrera 2009-07-20 15:09:14 Re: fix: plpgsql: return query and dropped columns problem

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2009-07-20 16:43:46 Re: hot standby - merged up to CVS HEAD
Previous Message Kevin Grittner 2009-07-20 16:32:22 Re: Review: Revise parallel pg_restore's scheduling heuristic