pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Johnston <polobo@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: Re: Update a composite nested type variable
Date: Mon, 8 Jul 2013 12:01:25 -0700 (PDT)
Message-ID: <1373310085989-5763082.post@n5.nabble.com> (raw)
In-Reply-To: <CAHZ=uVA9jV32M2NYhthHssS-Ra-ttYAkfL+OmH5D3b07gCivHg@mail.gmail.com>
References: <CAHZ=uVA9jV32M2NYhthHssS-Ra-ttYAkfL+OmH5D3b07gCivHg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

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.ht...
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



view thread (4+ messages)  latest in thread

Message-ID: <1373310085989-5763082.post@n5.nabble.com>
Permalink:  ../1373310085989-5763082.post@n5.nabble.com/
Also on:    postgresql.org/message-id/1373310085989-5763082.post@n5.nabble.com

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: polobo@yahoo.com
  Subject: Re: Update a composite nested type variable
  In-Reply-To: <1373310085989-5763082.post@n5.nabble.com>

* 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