Обсуждение: Arrays, types and prodedures

Поиск
Список
Период
Сортировка

Arrays, types and prodedures

От
"Chris Hoy"
Дата:

Hi

I am having trouble passing arrays of types to a store procedure
I have the following type
CREATE TYPE IndexElement AS (    keyname text,    keytype integer);

and the header for the store prodedure is as follows:

CREATE OR REPLACE FUNCTION doIndexGroupCount(   indexs IndexElement[],   customerid INTEGER ,   logic INTEGER )

but when I try and call it using the following code
SELECT * from doIndexGroupCount(ARRAY[('dog', 1),('cat', 1)],10,0);

I get and error
ERROR: could not find array type for data type record

What am I missing?

Chris






Re: Arrays, types and prodedures

От
"Pavel Stehule"
Дата:
hello


2008/7/25 Chris Hoy <chris.hoy@hoyc.fsnet.co.uk>:
>
>
> Hi
>
> I am having trouble passing arrays of types to a store procedure
> I have the following type
>
>        CREATE TYPE IndexElement AS (
>                keyname text,
>                keytype integer
>        );
>
> and the header for the store prodedure is as follows:
>
> CREATE OR REPLACE FUNCTION doIndexGroupCount(
>    indexs IndexElement[],
>    customerid INTEGER ,
>    logic INTEGER )
>
> but when I try and call it using the following code
>
>        SELECT * from doIndexGroupCount(ARRAY[('dog', 1),('cat', 1)],10,0);
>
> I get and error
>
>        ERROR: could not find array type for data type record
>
> What am I missing?
>

casting

postgres=# select ARRAY[('dog', 1),('cat', 1)]::indexelement[];        array
-----------------------{"(dog,1)","(cat,1)"}
(1 row)

regards
Pavel Stehule

> Chris
>
>
>
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>