Re: Seamless replacement to MySQL's GROUP_CONCAT function...

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: "immersive(dot)excel(at)gmail(dot)com" <immersive(dot)excel(at)gmail(dot)com>, x3v0-pgsql(at)yahoo(dot)com, pgsql-general(at)postgresql(dot)org, David Fetter <david(at)fetter(dot)org>
Subject: Re: Seamless replacement to MySQL's GROUP_CONCAT function...
Date: 2013-08-06 05:26:12
Message-ID: 20130806052612.GA10718@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message ascot.moss@gmail.com 2013-08-06 05:33:41 Re: pg_stat_replication became empty suddenly
Previous Message immersive.excel@gmail.com 2013-08-06 05:10:35 Re: Seamless replacement to MySQL's GROUP_CONCAT function...