Skip site navigation (1) Skip section navigation (2)

Re: Arrays, types and prodedures

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Chris Hoy" <chris(dot)hoy(at)hoyc(dot)fsnet(dot)co(dot)uk>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Arrays, types and prodedures
Date: 2008-07-25 08:38:49
Message-ID: 162867790807250138j50ac624cw3439a7c09c0e392f@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-sql
hello


2008/7/25 Chris Hoy <chris(dot)hoy(at)hoyc(dot)fsnet(dot)co(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

In response to

pgsql-sql by date

Next:From: Anoop GDate: 2008-07-25 09:12:21
Subject: Re: postgres time zone settings(time difference in Server and client)
Previous:From: Chris HoyDate: 2008-07-25 08:32:23
Subject: Arrays, types and prodedures

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group