From: | Michael Kolomeitsev <mkolomeitsev(at)gmail(dot)com> |
---|---|
To: | Vibhor Kumar <vibhor(dot)kumar(at)enterprisedb(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Nested composite types again |
Date: | 2012-11-28 16:51:52 |
Message-ID: | CAABbzO03D51M-Hh7-CpZaSBOitqhGU0=pntRJnOoynBULE_C6Q@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Ok.
How do you think should I report this as a bug?
On Nov 28, 2012 10:37 PM, "Vibhor Kumar" <vibhor(dot)kumar(at)enterprisedb(dot)com>
wrote:
>
> On Nov 28, 2012, at 5:02 AM, Michael Kolomeitsev <mkolomeitsev(at)gmail(dot)com>
> wrote:
>
> > Hi,
> >
> > I have already read this
> > http://www.postgresql.org/docs/9.2/static/rowtypes.html#AEN7304
> > but it didn't help.
> >
> > CREATE TABLE nodes (
> > id SERIAL NOT NULL PRIMARY KEY,
> > name TEXT NOT NULL
> > );
> >
> > CREATE TYPE pathId AS (
> > id INTEGER,
> > node nodes
> > );
> >
> > CREATE OR REPLACE FUNCTION test_AEN7304() RETURNS void AS $$
> > DECLARE
> > r pathId;
> > n nodes;
> > BEGIN
> > n.name := 'abc';
> > r.id := 1;
> > r.node := n; -- All is ok
> > -- r.node.name := 'def'; -- << Error here
> > -- (r).node.name := 'def'; -- << and here
> > ((r).node).name := 'def'; -- << and here
> > END;
> > $$ LANGUAGE 'plpgsql';
> >
> > And I can't even make 'n' as ALIAS FOR r.node (to simulate C-like
> pointer).
> >
> > What is the right syntax?
> > Thanks
>
> I have verified that plpgsql doesn't allow assignment like r.node.name='def'
> or (r).node.name or ((r).node).name
>
> In Above case, you can use some variable like n and update the n composite
> variable and assigned it to r.node as you have already done in plpgsql.
>
> Thanks & Regards,
> Vibhor Kumar
> EnterpriseDB Corporation
> The Enterprise PostgreSQL Company
> Blog:http://vibhork.blogspot.com
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Christian Hammers | 2012-11-28 17:59:42 | Re: Nested composite types again |
Previous Message | Vibhor Kumar | 2012-11-28 15:37:07 | Re: Nested composite types again |