All Projects → JDBurnZ → Postgresql Anyarray

JDBurnZ / Postgresql Anyarray

Licence: other
PostgeSQL extension adding highly desirable, data-type independent array functionality.

Labels

Projects that are alternatives of or similar to Postgresql Anyarray

Ms Sql Server Group Concat Sqlclr
SQL Server CLR user-defined aggregates that collectively offer similar functionality to the MySQL GROUP_CONCAT function. Specialized functions ensure the best performance based on required functionality. Aggregates implemented using C#; requires .NET Framework 3.5.
Stars: ✭ 54 (-40.66%)
Mutual labels:  plpgsql
Code Or Die
Code or Die: A Game for Galactical Domination
Stars: ✭ 63 (-30.77%)
Mutual labels:  plpgsql
Openquerystore
OpenQueryStore
Stars: ✭ 75 (-17.58%)
Mutual labels:  plpgsql
Pgformatter
A PostgreSQL SQL syntax beautifier that can work as a console program or as a CGI. On-line demo site at http://sqlformat.darold.net/
Stars: ✭ 1,085 (+1092.31%)
Mutual labels:  plpgsql
Pg
PostgreSQL experiments
Stars: ✭ 60 (-34.07%)
Mutual labels:  plpgsql
Ora migrator
Tools for Oracle to PostgreSQL migration
Stars: ✭ 66 (-27.47%)
Mutual labels:  plpgsql
Postgresql Functions
Custom PostgreSQL functions and extensions
Stars: ✭ 50 (-45.05%)
Mutual labels:  plpgsql
Evergreen
Evergreen ILS
Stars: ✭ 85 (-6.59%)
Mutual labels:  plpgsql
Docker Postgis
This repository contains Docker image builds for PostgreSQL / PostGIS
Stars: ✭ 62 (-31.87%)
Mutual labels:  plpgsql
Openmaptiles
OpenMapTiles Vector Tile Schema Implementation
Stars: ✭ 1,175 (+1191.21%)
Mutual labels:  plpgsql
Pgulid
Universally Unique Lexicographically Sortable Identifier (ULID) for PostgreSQL
Stars: ✭ 56 (-38.46%)
Mutual labels:  plpgsql
Pg Clone Schema
Postgres clone schema utility without need of going outside of database. Makes developers life easy by running single function to clone schema with all objects. It is very handy on Postgres RDS. Utility is sponsored by http://elephas.io/
Stars: ✭ 59 (-35.16%)
Mutual labels:  plpgsql
Postgrest Example
Migrations for an example conference API
Stars: ✭ 69 (-24.18%)
Mutual labels:  plpgsql
Pg partman
Partition management extension for PostgreSQL
Stars: ✭ 1,085 (+1092.31%)
Mutual labels:  plpgsql
R Server Hospital Length Of Stay
Hospital length of stay prediction solution with Microsoft R Server
Stars: ✭ 76 (-16.48%)
Mutual labels:  plpgsql
Fias2pgsql
Скрипты для импорта ФИАС в Postgresql
Stars: ✭ 54 (-40.66%)
Mutual labels:  plpgsql
Basketball
Public subset of my basketball github
Stars: ✭ 65 (-28.57%)
Mutual labels:  plpgsql
Cartodb Postgresql
PostgreSQL extension for CartoDB
Stars: ✭ 90 (-1.1%)
Mutual labels:  plpgsql
Ssis Queries
A set of queries useful to easily extract monitoring and package performance data from SSISDB database
Stars: ✭ 79 (-13.19%)
Mutual labels:  plpgsql
Pg bitemporal
Bitemporal tables in Postgres
Stars: ✭ 70 (-23.08%)
Mutual labels:  plpgsql

anyarray

A set of PostgeSQL functions adding highly desirable, data-type independent array functionality.

Inspired by intarray's complete disregard for all non-integer data-types.

license

Please refer to the LICENSE file for licensing and copyright information.

source code

anyarray source code, documentation and examples are available on GitHub at: https://www.github.com/JDBurnZ/anyarray

compatibility

Tested on PostgreSQL 9.1, 9.2 and 9.3, but should be compatible with all versions which support arrays.

  • PostgreSQL 8.x
  • PostgreSQL 9.x

functions

Method Returns Description
anyarray_concat(anyarray, anyarray) anyarray Returns the first argument with values from the second argument appended to it.
anyarray_concat(anyarray, anynonarray) anyarray Returns the first argument with the second argument appended appended to it.
anyarray_concat_uniq(anyarray, anyarray) anyarray Returns the first argument with values from the second argument (which are not in the first argument) appended to it.
anyarray_concat_uniq(anyarray, anynonarray) anyarray Returns the first argument with the second argument appended to it, if the second argument isn't in the first argument.
anyarray_diff(anyarray, anyarray) anyarray Returns an array of every element which is not common between arrays.
anyarray_diff_uniq(anyarray, anyarray) anyarray Returns an array of every unique value which is not common between arrays.
anyarray_enumerate(anyarray) TABLE (index bigint, value anyelement) Unnests the array along with the indices of each element.
anyarray_is_array(anyelement) boolean Determines whether or not the argument passed is an array.
anyarray_numeric_only(anyarray) anyarray Returns the array passed with all non-numeric values removed from it. Retains whole and decimal values.
anyarray_ranges(anyarray) text[] Converts an array of values into ranges. Currently only supports smalling, integer and bigint.
anyarray_remove(anyarray, anyarray) anyarray Returns the first argument with all values from the second argument removed from it.
anyarray_remove(anyarray, anynonarray) anyarray Returns the first argument with all values matching the second argument removed from it.
anyarray_remove_null(anyarray) anyarray Returns an array with all occurrences of NULL omitted.
anyarray_sort(anyarray) anyarray Returns the array, sorted.
anyarray_uniq(anyarray) anyarray Returns an array of unique values present within the array passed.

aggregates

Method Returns Description
anyarray_agg(anyarray) anyarray Concatenates arrays into a single array when aggregating.

operators

Coming Soon!

examples

Query Return Data-Type Result
SELECT anyarray_concat(
	ARRAY[1, 2],
	ARRAY[2, 3]
)
integer[]
{1,2,2,3}
SELECT anyarray_concat(
	ARRAY['one', 'two'],
	ARRAY['two', 'three']
)
text[]
{one,two,two,three}
SELECT anyarray_concat(
	ARRAY[1, 2],
	2
)
integer[]
{1,2,2}
SELECT anyarray_concat(
	ARRAY['one', 'two'],
	'two'::text
)
text[]
{one,two,two}
SELECT anyarray_concat_uniq(
	ARRAY[1, 2],
	ARRAY[2, 3]
)
integer[]
{1,2,3}
SELECT anyarray_concat_uniq(
	ARRAY['one', 'two'],
	ARRAY['two', 'three']
)
text[]
{one,two,three}
SELECT anyarray_concat_uniq(
	ARRAY[1, 2],
	2
)
integer[]
{1,2}
SELECT anyarray_concat_uniq(
	ARRAY[1, 2],
	3
)
integer[]
{1,2,3}
SELECT anyarray_concat_uniq(
	ARRAY['one', 'two'],
	'two'::text
)
text[]
{one,two}
SELECT anyarray_concat_uniq(
	ARRAY['one', 'two'],
	'three'::text
)
text[]
{one,two,three}
SELECT anyarray_diff(
	ARRAY[1, 1, 2],
	ARRAY[2, 3, 4, 4]
)
integer[]
{1,1,3,4,4}
SELECT anyarray_diff(
	ARRAY['one', 'one', 'two'],
	ARRAY['two', 'three', 'four', 'four']
)
text[]
{one,one,three,four,four}
SELECT anyarray_diff_uniq(
	ARRAY[1, 1, 2],
	ARRAY[2, 3, 4, 4]
)
integer[]
{1,3,4}
SELECT anyarray_diff_uniq(
	ARRAY['one', 'one', 'two'],
	ARRAY['two', 'three', 'four', 'four']
)
text[]
{one,three,four}
SELECT *
FROM anyarray_enumerate(
	ARRAY[
		'foo', 'bar', 'spam', 'eggs'
	]::TEXT[]
);
TABLE (index bigint, value text)
{1,'foo'}
{2,'bar'}
{3,'spam'}
{4,'eggs'}
SELECT *
FROM anyarray_enumerate(
	ARRAY[
		ARRAY['foo', 'bar'],
		ARRAY['spam', 'eggs']
	]::TEXT[]
);
TABLE (index bigint, value text)
{1,'foo'}
{2,'bar'}
{3,'spam'}
{4,'eggs'}
SELECT anyarray_numeric_only(
	ARRAY['1', '1.1', '1.1a', '1.a', 'a']::text[]
)
text[]
{1,1.1}
SELECT anyarray_numeric_only(
	ARRAY[1, 1.1, 1.1234567890]::numeric[]
)
numeric[]
{1,1.1,1.1234567890}
SELECT anyarray_is_array(ARRAY[1, 2])
boolean[]
TRUE
SELECT anyarray_is_array(ARRAY['one', 'two'])
boolean[]
TRUE
SELECT anyarray_is_array(1)
boolean[]
FALSE
SELECT anyarray_is_array('one'::text)
boolean[]
FALSE
SELECT anyarray_ranges(ARRAY[1, 2, 4, 5, 6, 9])
text[]
{1-2,4-6,9}
SELECT anyarray_ranges(ARRAY[1.1, 1.2, 2, 3, 5])
text[]
{1.1,1.2,2-3,5}
SELECT anyarray_remove(
	ARRAY[1, 2],
	ARRAY[2, 3]
)
integer[]
{1}
SELECT anyarray_remove(
	ARRAY['one', 'two'],
	ARRAY['two', 'three']
)
text[]
{one}
SELECT anyarray_remove(
	ARRAY[1, 2],
	2
)
integer[]
{1}
SELECT anyarray_remove(
	ARRAY['one', 'two'],
	'two'::text
)
text[]
{one}
SELECT anyarray_remove_null(ARRAY[1, 2, NULL, 4])
integer[]
{1,2,4}
SELECT anyarray_remove_null(ARRAY['one', 'two', NULL, 'four'])
text[]
{one,two,four}
SELECT anyarray_sort(ARRAY[1, 46, 15, 3])
integer[]
{1,3,15,46}
SELECT anyarray_sort(ARRAY['1', '46', '15', '3'])
integer[]
{1,15,3,46}
SELECT anyarray_sort(ARRAY['one', 'forty-six', 'fifteen', 'three'])
text[]
{fifteen,forty-six,one,three}
SELECT anyarray_uniq(ARRAY[1, 2, 3, 2, 1])
integer[]
{1,2,3}
SELECT anyarray_uniq(ARRAY['one', 'two', 'three', 'two', 'one'])
text[]
{one,two,three}
SELECT id, anyarray_agg(list)
FROM (VALUES
	('a', ARRAY[1,2]),
	('a', ARRAY[3,4]),
	('b', ARRAY[5,6]),
	('b', ARRAY[7,8])
) AS data (id, list)
GROUP BY id
text, integer[]
'a', {1,2,3,4}
'b', {5,6,7,8}
SELECT id, anyarray_agg(ARRAY[list])
FROM (VALUES
	('a', ARRAY[1,2]),
	('a', ARRAY[3,4]),
	('b', ARRAY[5,6]),
	('b', ARRAY[7,8])
) AS data (id, list)
GROUP BY id
text, integer[]
'a', {{1,2},{3,4}}
'b', {{5,6},{7,8}}

Donations

AnyArray is free software, but donations help the developer spend more time maintaining this project and others like it.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].