Re: Assigning Values to Composite Types

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gary Chambers <gwchamb(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Assigning Values to Composite Types
Date: 2009-10-22 18:28:37
Message-ID: 11871.1256236117@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Gary Chambers <gwchamb(at)gmail(dot)com> writes:
> /* Here is where I am stuck trying to fill data
> I've tried:

> data.term_count.coord_type := S;
> (data.term_count).coord_type := S;
> data.(term_count.coord_type) := S;
> */

I'm afraid plpgsql isn't tremendously bright about such cases. If
you have all the values available at once, though, it seems like
you should be able to do

data.term_count := row(this, that, the_other);

An explicit cast of the row() construct to the target column's type
might be a good idea --- I think it would work without, but probably
not with good performance.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message the6campbells 2009-10-22 20:41:20 question about timestamp with tz
Previous Message Gary Chambers 2009-10-22 17:31:11 Assigning Values to Composite Types