From: Guy Fraser <guy@incentre.net>
To: pgsql-sql@postgresql.org
Subject: Re: Passing arrays
Date: Wed, 19 Feb 2003 12:06:56 -0700
Message-ID: <3E53D5D0.7020104@incentre.net> (raw)
References: <Pine.LNX.4.44.0302141007300.16950-100000@matrix.gatewaynet.com>
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@megazone23.bigpanda.com]
>>>Sent: Friday, 14 February 2003 12:58 PM
>>>To: Michael Weaver
>>>Cc: 'pgsql-novice@postgresql.org'; 'pgsql-sql@postgresql.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...
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: guy@incentre.net
Subject: Re: Passing arrays
In-Reply-To: <3E53D5D0.7020104@incentre.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox