Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a6Moh-0008QT-1U for pgsql-bugs@arkaria.postgresql.org; Tue, 08 Dec 2015 18:16:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a6Mog-0007hN-Jj for pgsql-bugs@arkaria.postgresql.org; Tue, 08 Dec 2015 18:16:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a6Mof-0007h2-Tb for pgsql-bugs@postgresql.org; Tue, 08 Dec 2015 18:16:46 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a6Mod-0002lq-0i for pgsql-bugs@postgresql.org; Tue, 08 Dec 2015 18:16:44 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id tB8IGcti013820; Tue, 8 Dec 2015 13:16:38 -0500 From: Tom Lane To: pplachta@gmail.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13796: ALTER TYPE DROP COLUMN -- unexpected behavior ? In-reply-to: <20151204115704.5889.65257@wrigleys.postgresql.org> References: <20151204115704.5889.65257@wrigleys.postgresql.org> Comments: In-reply-to pplachta@gmail.com message dated "Fri, 04 Dec 2015 11:57:04 +0000" Date: Tue, 08 Dec 2015 13:16:38 -0500 Message-ID: <13819.1449598598@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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