Skip to content

klando/array_filter

Repository files navigation

========================
 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+


About

An array_filter implementation for PostgreSQL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published