On Mon, Jul 20, 2009 at 10:09 AM, Alvaro
Herrera<alvherre@commandprompt.com> wrote:
> Tom Lane escribi=C3=B3:
>> Jaime Casanova <jcasanov@systemguards.com.ec> writes:
>> > this one applies, compiles and it actually fixes the bug...
>>
>> And introduces a bunch of new ones. =C2=A0Surely you don't think that ve=
rsion
>> 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 =3D 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;
--=20
Atentamente,
Jaime Casanova
Soporte y capacitaci=C3=B3n de PostgreSQL
Asesor=C3=ADa y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157