arrays, composite types

From: Roman Neuhauser <neuhauser(at)sigpipe(dot)cz>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: arrays, composite types
Date: 2005-09-11 12:49:20
Message-ID: 20050911124920.GB62253@isis.sigpipe.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm looking for an equivalent of my_composite_type[] for use as a
parameter of a pl/pgsql function. What do people use to dodge this
limitation?

Background: I have a few plpgsql functions that basically accept an
array of objects decomposed into arrays of the objects' attributes:

CREATE FUNCTION do_foo(int4, int4[], int4[], varchar[]) RETURNS int4 VOLATILE

which I'd like to convert to

CREATE FUNCTION do_foo(int4, myctype[]) RETURNS int4 VOLATILE

so that the functions only need recompilation when myctype changes.

myctype is

CREATE TYPE myctype AS (a int4, b int4, c varchar)

Ideally, what I'm looking for will work in plpgsql, but I'm ok with
writing a bit or two in C as long as it can be made short,
selfcontained, and bugfree (crashing PostgreSQL or wrong data would be
enough rope to hang myself on I'm afraid).

BTW, I don't see arrays of composite types in the TODO, and the ability
to specify composite types indirectly through schema.rel.attr%TYPE isn't
there either. Are these two features out of the question for some
reason?

--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Mayer 2005-09-11 12:52:07 Re: Postgresql Hosting
Previous Message Sim Zacks 2005-09-11 09:26:36 pg_autovacuum not doing anything