Sha256: 829aab004497dfc4ababf0bce34af244b781da8b979e227c29c31f7dd65fe0da

Contents?: true

Size: 496 Bytes

Versions: 4

Compression:

Stored size: 496 Bytes

Contents

/* 
 mysqlcompat-1.0b3
 public domain
 GROUP_CONCAT()
 Note: For DISTINCT and ORDER BY a subquery is required
*/

CREATE OR REPLACE FUNCTION _group_concat(text, text)
RETURNS text AS $$
  SELECT CASE
    WHEN $2 IS NULL THEN $1
    WHEN $1 IS NULL THEN $2
    ELSE $1 operator(pg_catalog.||) ' ' operator(pg_catalog.||) $2
  END
$$ IMMUTABLE LANGUAGE SQL;

DROP AGGREGATE IF EXISTS group_concat(text);

CREATE AGGREGATE group_concat (
	BASETYPE = text,
	SFUNC = _group_concat,
	STYPE = text
);

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ultrasphinx-1.6.7 lib/ultrasphinx/postgresql/group_concat.sql
ultrasphinx-1.8 lib/ultrasphinx/postgresql/group_concat.sql
ultrasphinx-1.9 lib/ultrasphinx/postgresql/group_concat.sql
ultrasphinx-1.7 lib/ultrasphinx/postgresql/group_concat.sql