Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UwKo1-0006bN-I9 for pgsql-sql@arkaria.postgresql.org; Mon, 08 Jul 2013 23:25:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1UwKo0-0005ct-Ry for pgsql-sql@arkaria.postgresql.org; Mon, 08 Jul 2013 23:25:16 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UwKnz-0005cN-Ug for pgsql-sql@postgresql.org; Mon, 08 Jul 2013 23:25:16 +0000 Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UwKnx-0007eS-AW for pgsql-sql@postgresql.org; Mon, 08 Jul 2013 23:25:15 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1UwKnw-0005vh-Qp for pgsql-sql@postgresql.org; Mon, 08 Jul 2013 16:25:12 -0700 Date: Mon, 8 Jul 2013 16:25:12 -0700 (PDT) From: David Johnston To: pgsql-sql@postgresql.org Message-ID: <1373325912825-5763119.post@n5.nabble.com> In-Reply-To: References: <1373310085989-5763082.post@n5.nabble.com> Subject: Re: Update a composite nested type variable MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 4.5 (++++) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Luca Vernini wrote > 2013/7/8 David Johnston < > polobo@ > > > >> >> This may be a pl/pgsql limitation but you should probably provide a >> complete >> self-contained example with your attempt so that user-error can be >> eliminated. >> >> David J. >> >> > All right. Here you are a complete example. Just tested it. > Sorry for the long email. This does appear to be a limitation. The documentation says pl/pgsql allows for "simple variables" in the target which 2-layer composite types do not qualify for. As a work-around I'd suggest creating local variables for each of the relevant fields - say by using the same names but with "_" instead of "."; You will then need to reconstruct each complex value from the basic values and return the reconstructed value. r_cus_id := retset.cus_data.id; r_cus_name := retset.cus_data.name; r_cus_email := retset.cus_data.email; r_superpower := retset.superpower: RETURN SELECT (r_cus_id, r_cus_name, r_cus_email)::type_customer, r_superpower)::type_supercustomer; Not tested but as I am writing this I am getting a Deja-Vu sensation which I think means I am correct and that this somewhat convoluted way is what you've got. David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Update-a-composite-nested-type-variable-tp5763023p5763119.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql