array of composite types - how can I launch this function with an array of composite values

From: "Nikita Koselev" <koselev(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: array of composite types - how can I launch this function with an array of composite values
Date: 2008-10-05 06:51:39
Message-ID: 24e54d80810042351l6823473dn2a9465a3a2e8adbd@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have a composite type, like
--
CREATE TYPE requirement_vo AS (
name VARCHAR(20),
description VARCHAR(20),
requirement_id INT,
requirement_type_id INT,
priority_id INT,
necessity_id INT,
lower_limit DOUBLE PRECISION,
upper_limit DOUBLE PRECISION
);
--
and I have a function
--
CREATE OR REPLACE FUNCTION add_position(rs requirement_vo[] )
--

Code like this
--
SELECT * FROM add_position('{("name", "descr", "req_id", "req_type_id",
"priority_id", "nec_id", 2.1321, 1.2323)}');
--
returns "ERROR: malformed array literal: "{("name", "descr", "req_id",
"req_type_id",
"priority_id", "nec_id", 2.1321, 1.2323)}"
SQL state: 22P02
"

So the question is - how can I launch this function with an array of
composite values?
Documentation (http://www.postgresql.org/docs/8.3/interactive/arrays.html)
says "Arrays of ... or composite type can be created."

Nikita Koselev

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Nikita Koselev 2008-10-05 06:54:10 DESCRIBE for composite type?
Previous Message Harold A. Giménez Ch. 2008-10-04 01:10:34 Re: Optimizing sum() operations