From: Tom Lane <tgl@sss.pgh.pa.us>
To: pplachta@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #13796: ALTER TYPE DROP COLUMN -- unexpected behavior ?
Date: Tue, 08 Dec 2015 13:16:38 -0500
Message-ID: <13819.1449598598@sss.pgh.pa.us> (raw)
In-Reply-To: <20151204115704.5889.65257@wrigleys.postgresql.org>
References: <20151204115704.5889.65257@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
pplachta@gmail.com writes:
> create type complex as (a1 int, a2 numeric, a3 text, a4 int, a5 int);
> create or replace function foo(arg complex) returns complex as $$
> begin
> return ( select arg );
> end; $$ language plpgsql;
> alter type complex drop attribute a4;
> [ foo() stops working ]
Yeah, the problem is that since "arg" has a named composite type, it is
handled using the PLPGSQL_DTYPE_ROW code path, which sets up a plpgsql
Datum for each column at function compile time. So the rowtype is baked
into the function at that point. If you start a fresh session everything
is fine.
A real fix might involve switching over to the PLPGSQL_DTYPE_REC code
path, which I've advocated for for some time but it'd be pretty invasive.
Or perhaps we could arrange to force recompilation of a plpgsql function
if any composite type it depends on has changed. Nobody's really gotten
excited enough about this to do either ...
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, pplachta@gmail.com
Subject: Re: BUG #13796: ALTER TYPE DROP COLUMN -- unexpected behavior ?
In-Reply-To: <13819.1449598598@sss.pgh.pa.us>
References: <20151204115704.5889.65257@wrigleys.postgresql.org> <13819.1449598598@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox