-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.array_filter
More file actions
71 lines (49 loc) · 1.21 KB
/
Copy pathREADME.array_filter
File metadata and controls
71 lines (49 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
========================
array_filter extension
========================
:Version: 1.0
:Date: May 11 2011
:Authors: Cédric Villemain
Marko Tiikkaja
:Copyright: Copyright (C) 2010-2011, 2ndQuadrant France SAS
:Licence: BSD
.. section-numbering::
.. contents::
array_filter
============
array_filter filters elements of an array using a callback function, the
returned array can be of a limited size.
Usage
-----
::
=# SELECT array_filter('{abcd,bcde,cdef,defg}'::text[], 'pg_catalog.texticlike', 2, '%cd%');
array_filter
--------------
abcd
bcde
=# create function is_between(integer, integer, integer)
returns boolean as $$ select $1 >= $2 and $1 <= $3; $$
language sql immutable;
=# select array_filter(array[1,2,3,4,5], 'is_between', 3, '2', '4');
array_filter
--------------
2
3
4
Install
=======
:Debian:
::
USE_PGXS=1 make clean
USE_PGXS=1 make deb
dpkg -i ../postgresql-9.0-array-filter-1.0.0.deb
psql -f /usr/share/postgresql/9.0/contrib/array_filter.sql my_db
:traditionnal:
::
USE_PGXS=1 make clean
USE_PGXS=1 make
USE_PGXS=1 make install
psql -f $PGPATH/share/contrib/array_filter.sql my_db
TODO
====
Needs update to work with PostgreSQL 9.3+