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