X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/3ac9bdcaf2633da20fc12464eddc946417689b48..0bb6aed531f07d348ac70b7d6a47526e957485ed:/sql/Pg-upgrade2/PgCommaAggregateFunction.sql diff --git a/sql/Pg-upgrade2/PgCommaAggregateFunction.sql b/sql/Pg-upgrade2/PgCommaAggregateFunction.sql new file mode 100644 index 000000000..c2e10ae3e --- /dev/null +++ b/sql/Pg-upgrade2/PgCommaAggregateFunction.sql @@ -0,0 +1,15 @@ +-- @tag: PgCommaAggregateFunction +-- @description: Neue Postgres Funktion zur Abfrage mehrdeutiger Ergebniszeilen als kommagetrennte Liste +-- @depends: release_2_4_1 +-- Taken from: http://www.zigo.dhs.org/postgresql/#comma_aggregate +-- Copyright © 2005 Dennis Björklund +-- License: Free +-- Thx. to A. Kretschmer, http://archives.postgresql.org/pgsql-de-allgemein/2007-02/msg00006.php +CREATE FUNCTION comma_aggregate(text,text) RETURNS text AS ' + SELECT CASE WHEN $1 <> '''' THEN $1 || '', '' || $2 + ELSE $2 + END; +' LANGUAGE sql IMMUTABLE STRICT; + +CREATE AGGREGATE comma (basetype=text, sfunc=comma_aggregate, stype=text, initcond='' ); +