pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gary Chambers <gwchamb@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Assigning Values to Composite Types
Date: Thu, 22 Oct 2009 14:28:37 -0400
Message-ID: <11871.1256236117@sss.pgh.pa.us> (raw)
In-Reply-To: <302670f20910221031v6cc61b5bq27accbf7d928d024@mail.gmail.com>
References: <302670f20910221031v6cc61b5bq27accbf7d928d024@mail.gmail.com>

Gary Chambers <gwchamb@gmail.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



view thread (2+ messages)

Message-ID: <11871.1256236117@sss.pgh.pa.us>
Permalink:  ../11871.1256236117@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11871.1256236117@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, gwchamb@gmail.com
  Subject: Re: Assigning Values to Composite Types
  In-Reply-To: <11871.1256236117@sss.pgh.pa.us>

* 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