Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fV6yY-0000iT-B2 for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Jun 2018 03:06:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fV6yV-0000XJ-W0 for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Jun 2018 03:06:31 +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.89) (envelope-from ) id 1fV6yV-0000XA-FU for pgsql-bugs@lists.postgresql.org; Tue, 19 Jun 2018 03:06:31 +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.89) (envelope-from ) id 1fV6yS-0004QE-7P for pgsql-bugs@lists.postgresql.org; Tue, 19 Jun 2018 03:06:29 +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 w5J36N7I012034; Mon, 18 Jun 2018 23:06:23 -0400 From: Tom Lane To: "David G. Johnston" cc: anderson.ant.oli@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15246: Does not allow an INOUT parameter to receive values when its data type is a user-defined data type. In-reply-to: References: <152936113475.1444.7277014546852553718@wrigleys.postgresql.org> Comments: In-reply-to "David G. Johnston" message dated "Mon, 18 Jun 2018 15:41:42 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <12032.1529377583.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Mon, 18 Jun 2018 23:06:23 -0400 Message-ID: <12033.1529377583@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "David G. Johnston" writes: > On Mon, Jun 18, 2018 at 3:32 PM, PG Bug reporting form < > noreply@postgresql.org> wrote: >> p_my_type.rc_tbl1.co_1 := 1; -- ERRO: "p_my_type.rc_tbl1.co_1" is >> not >> variable unknown !!!! > Short answer is that you cannot simply assign components of a composite > type one-at-a-time, you have to build up the full final composite result in > one expression and assign the result of the expression to the typed > variable (p_my_type in this instance).​ It's not quite that bad. IIRC, plpgsql handles only one level of field assignment, so you could write p_my_type.rc_tbl1 := ROW(1, 'Teeeeeeeeeeest'); but not p_my_type.rc_tbl1.co_1 := 1; Improving that --- and also allowing mixed array-element-and-field assignment, say "p_my_type.rc_tbl1[2].co_1 := 1;" --- has been on the radar screen for a long time, but nobody has gotten round to it. I think I might've made it a bit easier as of v11, because it'd no longer be necessary to implement field assignment in two separate code paths for "rows" and "records". But it's still a fair amount of work. regards, tom lane