Re: Seamless replacement to MySQL's GROUP_CONCAT function... - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Seamless replacement to MySQL's GROUP_CONCAT function...
Date
Msg-id 20130806052612.GA10718@eldon.alvh.no-ip.org
Whole thread Raw
In response to Re: Seamless replacement to MySQL's GROUP_CONCAT function...  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: Seamless replacement to MySQL's GROUP_CONCAT function...
Re: Seamless replacement to MySQL's GROUP_CONCAT function...
List pgsql-general
Pavel Stehule escribió:

> you code can be translated to
>
> CREATE OR REPLACE
> FUNCTION GROUP_CONCAT_ATOM(field1 TEXT, field2 TEXT, delimiter TEXT)
>          RETURNS TEXT AS $$
> BEGIN
>   RETURN COALESCE(field1||delimiter||field2, field2, field1);
> END;
> $$ LANGUAGE plpgsql;

Actually you don't even need plpgsql for this, do you ..

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Seamless replacement to MySQL's GROUP_CONCAT function...
Next
From: Pavel Stehule
Date:
Subject: Re: Seamless replacement to MySQL's GROUP_CONCAT function...