Re: fix: plpgsql: return query and dropped columns problem - Mailing list pgsql-bugs

From Jaime Casanova
Subject Re: fix: plpgsql: return query and dropped columns problem
Date
Msg-id 3073cc9b0907200934s586980ecy6e56e79eed6c867f@mail.gmail.com
Whole thread Raw
In response to Re: fix: plpgsql: return query and dropped columns problem  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: fix: plpgsql: return query and dropped columns problem  (Jaime Casanova <jcasanov@systemguards.com.ec>)
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: fix: plpgsql: return query and dropped columns problem
Next
From: Mathieu Fenniak
Date:
Subject: Bug 4906 -- Left join of subselect incorrect