Tom Lane kirjutas N, 13.03.2003 kell 19:12: > Peter Eisentraut <[EMAIL PROTECTED]> writes: > > OK, let's look at these more closely: > > >> array_push(anyarray, anyelement) returns anyarray > > > The standard spelling for that appears to be > > somearray || ARRAY[element] > > which also has the nice property that it is commutative. > > Sure ... but that just means that || is the operator name for the > underlying array_push function. We still need a way to declare this > operation as a function.
I think he mant that you just need to conacat for too arrays, no need for single-element push/append. OTOH a separate push may be more efficient contrib/intarray has the following functions (note that they use + for || above) OPERATIONS: int && int - overlap - returns TRUE if arrays has at least one common elements. int @ int - contains - returns TRUE if left array contains right array int ~ int - contained - returns TRUE if left array is contained in right array # int - return the number of elements in array int + int - push element to array ( add to end of array) int + int - merge of arrays (right array added to the end of left one) int - int - remove entries matched by right argument from array int - int - remove right array from left int | int - returns intarray - union of arguments int | int - returns intarray as a union of two arrays int & int - returns intersection of arrays int @@ query_int - returns TRUE if array satisfies query (like '1&(2|3)') query_int ~~ int - -/- ----------------- Hannu ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly