Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1868b0b

Browse files
committed
Small fix in documentation and some examples of usage. Please, apply to
7.3 and current CVSOleg Bartunov
1 parent9a39ba4 commit1868b0b

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

‎contrib/intarray/README.intarray

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,59 @@ signature with length of 4096 bits to represent sets).
88

99
All work was done by Teodor Sigaev (teodor@stack.net) and Oleg Bartunov
1010
(oleg@sai.msu.su). See http://www.sai.msu.su/~megera/postgres/gist
11-
for additional information. Andrey Oktyabrskihas done a great work on
11+
for additional information. Andrey Oktyabrskidid a great work on
1212
adding new functions and operations.
1313

1414

1515
FUNCTIONS:
1616

1717
int icount(int[]) - the number of elements in intarray
18+
19+
test=# select icount('{1,2,3}'::int[]);
20+
icount
21+
--------
22+
3
23+
(1 row)
24+
1825
int[] sort(int[], 'asc' | 'desc') - sort intarray
26+
27+
test=# select sort('{1,2,3}'::int[],'desc');
28+
sort
29+
---------
30+
{3,2,1}
31+
(1 row)
32+
1933
int[] sort(int[]) - sort in ascending order
2034
int[] sort_asc(int[]),sort_desc(int[]) - shortcuts for sort
35+
2136
int[] uniq(int[]) - returns unique elements
37+
38+
test=# select uniq(sort('{1,2,3,2,1}'::int[]));
39+
uniq
40+
---------
41+
{1,2,3}
42+
(1 row)
43+
2244
int idx(int[], int item) - returns index of first intarray matching element to item, or
2345
'0' if matching failed.
46+
47+
test=# select idx('{1,2,3,2,1}'::int[],2);
48+
idx
49+
-----
50+
2
51+
(1 row)
52+
53+
2454
int[] subarray(int[],int START [, int LEN]) - returns part of intarray starting from
2555
element number START (from 1) and length LEN.
2656

57+
test=# select subarray('{1,2,3,2,1}'::int[],2,3);
58+
subarray
59+
----------
60+
{2,3,2}
61+
(1 row)
62+
63+
2764
OPERATIONS:
2865

2966
int[] && int[] - overlap - returns TRUE if arrays has at least one common elements.
@@ -33,7 +70,7 @@ OPERATIONS:
3370
int[] + int - push element to array ( add to end of array)
3471
int[] + int[] - merge of arrays (right array added to the end of left one)
3572
int[] - int - remove entries matched by right argument from array
36-
int[] - int[] - removeleft array fromright
73+
int[] - int[] - removeright array fromleft
3774
int[] | int - returns intarray - union of arguments
3875
int[] | int[] - returns intarray as a union of two arrays
3976
int[] & int[] - returns intersection of arrays

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp