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

Re: Re: passing a temporary table with more than one column to a stored procedure

From: Viktor Rosenfeld <rosenfel(at)informatik(dot)hu-berlin(dot)de>
To: valgog <valgog(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Re: passing a temporary table with more than one column to a stored procedure
Date: 2008-04-29 21:04:25
Message-ID: 6347AA08-CBCC-4283-B3B0-1EE7F3D1ECCE@informatik.hu-berlin.de (view raw or flat)
Thread:
Lists: pgsql-general
Hi Valentine,

a little experimentation indicates that an aggregate function can  
solve my problem, using an int[] array as the state variable to encode  
the computed tuples of the result table so far and then using a costum  
function to decode the final returned array from the aggregate into  
the table I'm looking for.

I'm afraid though that the SQL aggregate semantics (like having to use  
GROUP BY and so on) will get in my way.

I'l let you know,
VIktor

Am 29.04.2008 um 10:30 schrieb valgog:
> It looks like you need an aggregate function... but aggregate would
> work in case, you want to return a RECORD and not a SETOF RECORD.
>
> In this case, you probably need to operate with arrays. Are you on
> 8.3? If yes, you would be able to pass an array of type to your
> function.
>
> You can accumulate your type-array with array_accum(anyelement)
> aggregate (http://www.postgresql.org/docs/8.3/static/xaggr.html)...
> but I am not sure about the memory consumption in case of large arrays
> being passed to the function.
>
> If you are in the 8.2, you can still convert any type to text, and
> deconvert in the function: textin(point_out('(1,1)'::point))
>
> With best regards,
>
> -- Valentine
>
>
> On Apr 28, 11:52 pm, rosen(dot)(dot)(dot)(at)informatik(dot)hu-berlin(dot)de (Viktor
> Rosenfeld) wrote:
>> Hi Jon,
>>
>> Am 28.04.2008 um 19:23 schrieb Roberts, Jon:
>>
>>>> What does the signature of graphovertokens look like?  Three
>>>> parmaters
>>> and it doesn't return a setof?
>>
>> This is my problem.  The return type is setof something (doesn't
>> really matter), but I don't know what to put into the argument list.
>>
>> Any ideas?
>>
>> Viktor
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-gene(dot)(dot)(dot)(at)postgresql(dot)org)
>> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general
>
>
> -- 
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general


In response to

pgsql-general by date

Next:From: Andy AndersonDate: 2008-04-29 21:46:35
Subject: Character Data Type 'Name'
Previous:From: Steve CrawfordDate: 2008-04-29 20:34:19
Subject: psql \pset pager

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