Plpgsql Array Correlation

Source: Internet
Author: User

Function Return Type Description Example Result
array_append(anyarray,anyelement) Anyarray Append an element to the end of an array Array_append (array[1,2], 3) {A-i}
array_cat(anyarray,anyarray) Anyarray CONCATENATE arrays Array_cat (array[1,2,3], array[4,5]) {1,2,3,4,5}
array_ndims(Anyarray) Int Returns the number of dimensions of the array Array_ndims (array[[1,2,3], [4,5,6]]) 2
array_dims(Anyarray) Text Returns a text representation of array ' s dimensions Array_dims (array[[1,2,3], [4,5,6]]) [1:2] [1:3]
array_fill(anyelement,int[], [, int[]]) Anyarray Returns an array initialized with supplied value and dimensions, optionally with lower bounds other than 1 Array_fill (7, array[3], array[2]) [2:4]={7,7,7}
array_length(anyarray,int) Int Returns the length of the requested array dimension Array_length (array[1,2,3], 1) 3
array_lower(anyarray,int) Int Returns lower bound of the requested array dimension Array_lower (' [0:2]={1,2,3} ':: int[], 1) 0
array_position (anyarray , anyelement  [, int ]) int returns the subscript of the first occurrence of the second argument in the array, starting at the element indicated B Y the third argument or at the first element (array must is one-dimensional) array_position ( array[' Sun ', ' mon ', ' Tue ', ' wed ', ' Thu ', ' Fri ', ' sat ', ' mon ') 2
array_positions(anyarray,anyelement) Int[] Returns an array of subscripts of any occurrences of the second argument in the array given as first argument (array must Be one-dimensional) Array_positions (array[' A ', ' a ', ' B ', ' a '], ' a ') {1,2,4}
array_prepend(anyelement,anyarray) Anyarray Append an element to the beginning of an array Array_prepend (1, array[2,3]) {A-i}
array_remove(anyarray,anyelement) Anyarray Remove all elements equal to the given value from the array (array must be one-dimensional) Array_remove (array[1,2,3,2], 2) {1,3}
array_replace(anyarray,anyelement, anyelement) Anyarray Replace each of the array element equal to the given value with a new value Array_replace (array[1,2,5,4], 5, 3) {1,2,3,4}
array_to_string(anyarray,text [, text]) Text Concatenates array elements using supplied delimiter and optional null string Array_to_string (Array[1, 2, 3, NULL, 5], ', ', ' * ') 1,2,3,*,5
array_upper(anyarray,int) Int Returns upper bound of the requested array dimension Array_upper (array[1,8,3,7], 1) 4
cardinality(Anyarray) Int Returns the total number of elements in the array, or 0 if the array is empty Cardinality (array[[1,2],[3,4]) 4
string_to_array(text,text [, text]) Text[] Splits string into array elements using supplied delimiter and optional null string String_to_array (' Xx~^~yy~^~zz ', ' ~^~ ', ' yy ') {Xx,null,zz}
unnest(Anyarray) Setof anyelement Expand an array to a set of rows Unnest (array[1,2])
12
(2 rows)
unnest(anyarray, anyarray[, ...]) Setof anyelement, Anyelement [, ...] Expand multiple arrays (possibly of different types) to a set of rows. Allowed in the FROM clause; See section 7.2.1.4 Unnest (array[1,2],array[' foo ', ' Bar ', ' Baz ')
1    foo2    barnull Baz
(3 rows)

Plpgsql Array Correlation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.