 --
 -- Copyright 2008 IHE International (http://www.ihe.net)
 --
 -- Licensed under the Apache License, Version 2.0 (the "License");
 -- you may not use this file except in compliance with the License.
 -- You may obtain a copy of the License at
 --
 -- http://www.apache.org/licenses/LICENSE-2.0
 --
 -- Unless required by applicable law or agreed to in writing, software
 -- distributed under the License is distributed on an "AS IS" BASIS,
 -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 -- See the License for the specific language governing permissions and
 -- limitations under the License.
 --

 
--
--  SQL Functions for Gazelle databases
--
DROP FUNCTION IF EXISTS comma_cat(text, text) CASCADE ;
CREATE FUNCTION comma_cat(text, text) RETURNS text AS $_$select case WHEN $2 is null or $2 = '' THEN $1 WHEN $1 is null or $1 = '' THEN $2 ELSE $1 || ', ' || $2 END$_$ LANGUAGE sql; 

ALTER FUNCTION public.comma_cat(text, text) OWNER TO gazelle;

--
-- Name: list(text); Type: AGGREGATE; Schema: public; Owner: gazelle
--

CREATE AGGREGATE list ( BASETYPE = text, SFUNC = comma_cat, STYPE = text, INITCOND = '');


ALTER AGGREGATE public.list(text) OWNER TO gazelle;

