From: | Guy Fraser <guy(at)incentre(dot)net> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Passing arrays |
Date: | 2003-02-19 19:06:56 |
Message-ID: | 3E53D5D0.7020104@incentre.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice pgsql-sql |
Can someone explain to me why people keep refering to contrib/intarray.
This person need help with a text array not an int array.
From what I can tell people keep refering to some GIST cruft but have never
supplied an example.
If I am missing something please let me know, I am sure all members of this
list would appreciate more details on the issues of arrays.
My wish list:
array_insert(array_column _std_array_types_[],element_insertion_point int)
returns _std_array_types_[]
array_replace(array_column _std_array_types_[],element_to_replace int) returns
std_array_types_[]
array_remove(array_column _std_array_types_[],element_to_remove int) returns
std_array_types_[]
array_append(array_column _std_array_types_[]) returns std_array_types_[]
array_accumulate(data_to_append _std_type_) returns _array_of_same_type_[]
array_size(array_column _std_array_types_[]) returns int
I have made my own array_size functions, but they are on one my machines at home.
I have been tring to build an agrigate "array_accumulate" for text data but
have not had success. Using my array_size function I tried to just use an
update but it would not work, this is basicly what I tried.
update table2 set data_array[array_size(data_array) + 1] = table1.new_data
where table2.id_data = table1.match_data;
The data in table1 was a list from the standard alias file as (alias text,dest
text) and the data in table2 was a distinct list of destinations from list1
and an array of '{nobody}' like this (dest text not null,aliases text[]
default '{nobody}').
When I run the update query only the first match is added to the array.
The other weirdness was, that I couldn't seen to add the first element of the
array. That may have been fixed though when I changed my function to remove
the "strict immutable" attributes.
I have not had any success trying to build a function to do the update so I
can use it in an aggrigate.
To make the functions type insensitive I have been thinking it may be possible
to cast the array or array data to text on input and back to the original type
on output, but I would rather find a better way to do it.
Guy
Achilleus Mantzios wrote:
> On Fri, 14 Feb 2003, Michael Weaver wrote:
..snip...
>>>-----Original Message-----
>>>From: Stephan Szabo [mailto:sszabo(at)megazone23(dot)bigpanda(dot)com]
>>>Sent: Friday, 14 February 2003 12:58 PM
>>>To: Michael Weaver
>>>Cc: 'pgsql-novice(at)postgresql(dot)org'; 'pgsql-sql(at)postgresql(dot)org'
>>>Subject: Re: [SQL] Passing arrays
...snip...
>
> Also check out contrib/intarray and its indexing capabilites
> if you have 1 dimensional integer arrays.
>
>
>>Thanks.
>>
>
...snip...
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Deroshia | 2003-02-19 20:45:15 | Re: null value in date field |
Previous Message | Bruno Wolff III | 2003-02-19 18:45:04 | Re: Foriegn key to Union query or two tables |
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Mitchell | 2003-02-19 19:16:22 | EXCEPT Queries |
Previous Message | Matthew Nuzum | 2003-02-19 18:51:58 | simple join problem |