Re: BUG #4673: pl/PgSQL: Bug, when updating changed composite types.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Oleg Serov <serovov(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4673: pl/PgSQL: Bug, when updating changed composite types.
Date: 2010-03-01 17:32:53
Message-ID: 603c8f071003010932j74dcf6d6wcda09b2f2046c9e6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Just to save anyone else reading through these the time it took for me
to figure this out, this was resubmitted as bug #5353, and Tom replied
to that one.

...Robert

2010/2/26 Oleg Serov <serovov(at)gmail(dot)com>:
> Hello!? anybody will fix this bug? Hey!
>
> On Mon, Feb 23, 2009 at 5:11 PM, Oleg <serovOv(at)gmail(dot)com> wrote:
>>
>> The following bug has been logged online:
>>
>> Bug reference:      4673
>> Logged by:          Oleg
>> Email address:      serovOv(at)gmail(dot)com
>> PostgreSQL version: 8.3.6
>> Operating system:   i686-redhat-linux-gnu
>> Description:        pl/PgSQL: Bug, when updating changed composite types.
>> Details:
>>
>> If you added a field into composite type(table type), plpgsql won't update
>> it, until you recompile function.
>>
>> DEMO SQL:
>>
>> ROLLBACK;
>> BEGIN;
>> CREATE TABLE bug_composite (
>>        column_a INT,
>>        column_b INT
>> );
>>
>> CREATE TABLE bug_parent (
>>        id INT,
>>        info bug_composite
>> );
>>
>> INSERT INTO bug_parent(id, info) VALUES (1, ROW(1, 2));
>>
>> CREATE OR REPLACE FUNCTION bug_update(r bug_parent) RETURNS void
>> AS
>> $BODY$
>> BEGIN
>>        UPDATE bug_parent
>>                SET info = r.info
>>                WHERE id = r.id;
>> END;
>> $BODY$ LANGUAGE 'plpgsql' VOLATILE;
>>
>> SELECT bug_update(ROW(1, ROW(3, 5)));
>>
>> SELECT * FROM bug_parent; -- WE WILL HAVE ROW(1, ROW(3, 5));
>>
>> ALTER TABLE bug_composite ADD COLUMN column_c INT;
>>
>> SELECT * FROM bug_parent; -- WE WILL HAVE ROW(1, ROW(3, 5, NULL));
>>
>> SELECT bug_update(ROW(1, ROW(4, 6, 9)));
>>
>> SELECT * FROM bug_parent; -- WE WILL HAVE ROW(1, ROW(4, 6, NULL));
>>
>> SELECT version(); -- "PostgreSQL 8.3.6 on i686-redhat-linux-gnu, compiled
>> by
>> GCC gcc (GCC) 4.1.2 20071124 (Red Hat 4.1.2-42)"
>>
>> --
>> Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-bugs
>
>
>
> --
> С уважением
>
> Олег Серов
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-03-01 18:17:08 Re: BUG #5356: citext not acting like case insensitive search
Previous Message Robert Haas 2010-03-01 17:30:23 Re: Bug in triggers