| From: | Luca Vernini <lucazeo(at)gmail(dot)com> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Update a composite nested type variable |
| Date: | 2013-07-08 13:11:28 |
| Message-ID: | CAHZ=uVA9jV32M2NYhthHssS-Ra-ttYAkfL+OmH5D3b07gCivHg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David Johnston | 2013-07-08 19:01:25 | Re: Update a composite nested type variable |
| Previous Message | Andreas | 2013-07-08 12:18:17 | monthly statistics |