X-Original-To: pgsql-sql@postgresql.org Received: from bach.ccinet.ab.ca (bach.ccinet.ab.ca [198.161.96.1]) by postgresql.org (Postfix) with ESMTP id 1BCC7475AEC for ; Wed, 19 Feb 2003 14:06:57 -0500 (EST) Received: from incentre.net (squid.incentre.net [206.75.213.195]) by bach.ccinet.ab.ca (8.12.6/8.12.6) with ESMTP id h1JJ7BGo065147 for ; Wed, 19 Feb 2003 12:07:11 -0700 (MST) (envelope-from guy@incentre.net) Message-ID: <3E53D5D0.7020104@incentre.net> Date: Wed, 19 Feb 2003 12:06:56 -0700 From: Guy Fraser Organization: J I Reasearch User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003 X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: Passing arrays References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200302/432 X-Sequence-Number: 11830 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...