From: Gary Chambers <gwchamb@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Assigning Values to Composite Types
Date: Thu, 22 Oct 2009 13:31:11 -0400
Message-ID: <302670f20910221031v6cc61b5bq27accbf7d928d024@mail.gmail.com> (raw)
All...
Given the following [hopefully] relevant portions of a function:
CREATE OR REPLACE FUNCTION solve(FLOAT8, VARCHAR, CHAR)
RETURNS SETOF sometype_t AS
$solve$
DECLARE
data sometype_t;
...
BEGIN
FOR term_count IN
SELECT DISTINCT coord_type AS coord_type, MAX(term) AS maxterms
...
LOOP
FOR i IN 0 .. term_count.maxterms LOOP
SELECT SUM(a + b + c) INTO Q
...
S := S + (Q * onevalue * somevalue);
END LOOP;
-- This is the only means of verifying/viewing the data
RAISE NOTICE '% = %', term_count.coord_type, S;
/* 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;
*/
S := 0.0;
END LOOP;
RETURN NEXT vsop87_data;
END;
$solve$ LANGUAGE plpgsql STRICT IMMUTABLE;
Is there a means of filling something.something.something with a value
so I can get all the values into a single row? Thanks very much in
advance.
-- Gary Chambers
/* Nothing fancy and nothing Microsoft! */
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: gwchamb@gmail.com
Subject: Re: Assigning Values to Composite Types
In-Reply-To: <302670f20910221031v6cc61b5bq27accbf7d928d024@mail.gmail.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