Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UwGgp-00024K-1P for pgsql-sql@arkaria.postgresql.org; Mon, 08 Jul 2013 19:01:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1UwGgo-0001VG-FS for pgsql-sql@arkaria.postgresql.org; Mon, 08 Jul 2013 19:01:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UwGgn-0001UE-DH for pgsql-sql@postgresql.org; Mon, 08 Jul 2013 19:01:33 +0000 Received: from sam.nabble.com ([216.139.236.26]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UwGgj-0004qj-84 for pgsql-sql@postgresql.org; Mon, 08 Jul 2013 19:01:33 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1UwGgf-00038Z-WC for pgsql-sql@postgresql.org; Mon, 08 Jul 2013 12:01:26 -0700 Date: Mon, 8 Jul 2013 12:01:25 -0700 (PDT) From: David Johnston To: pgsql-sql@postgresql.org Message-ID: <1373310085989-5763082.post@n5.nabble.com> In-Reply-To: References: 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: 1.8 (+) 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 > I'm writing a system with havy use of composite types. > I have a doubt. > > I'm writing all in functions with language plpgsql. > When I read a field from a composite type I must write something like > this: > status = ((in_customer.customer_data).customer_status).status_id > > And this works fine. I need to enclose the base type, but this is not a > problem. > > When I need to assign a value I try to write something like: > (in_customer.customer_data).field_a := NULL; > > But postgresql rise an error: > ERROR: syntax error at or near "(" > SQL state: 42601 > > If I dont use parentesis I rise a different error: > > ERROR: "in_customer.customer_data.field_a" is not a known variable > SQL state: 42601 > > 2 questions: > Why is the behavior so different in read and in assign. > How can I workaround this and update my values? > > Luca. 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. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Update-a-composite-nested-type-variable-tp5763023p5763082.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