Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id E4898633564 for ; Tue, 3 Aug 2010 17:35:40 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 63797-10 for ; Tue, 3 Aug 2010 20:35:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from spinlock.commandprompt.com (host-215.commandprompt.net [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id DC2F663359E for ; Tue, 3 Aug 2010 17:35:33 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by spinlock.commandprompt.com (Postfix) with ESMTP id 1510D348002; Tue, 3 Aug 2010 13:35:32 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at commandprompt.com Received: from spinlock.commandprompt.com ([127.0.0.1]) by localhost (spinlock.commandprompt.com.commandprompt.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5n6iEoRokLPO; Tue, 3 Aug 2010 13:35:29 -0700 (PDT) Received: from perhan.alvh.no-ip.org (190-95-29-207.bk17-dsl.surnet.cl [190.95.29.207]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id 80A6B34C210; Tue, 3 Aug 2010 13:35:29 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id DB2176E5E2; Tue, 3 Aug 2010 16:35:26 -0400 (CLT) Content-Type: text/plain; charset=UTF-8 Cc: pgsql-sql Subject: Re: How do you do the opposite of regexp_split_to_table? From: Alvaro Herrera To: John Gage In-reply-to: <4FA8D090-F145-485B-9062-7136CB8B6CB0@numericable.fr> References: <4FA8D090-F145-485B-9062-7136CB8B6CB0@numericable.fr> Date: Tue, 03 Aug 2010 16:35:26 -0400 Message-Id: <1280867576-sup-2555@alvh.no-ip.org> User-Agent: Sup/git Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201008/6 X-Sequence-Number: 34446 Excerpts from John Gage's message of mar ago 03 16:21:58 -0400 2010: > Grouping by summing numerical fields seems to be straightforward, but > grouping by concatenating text fields escapes my search of the > documentation. You can create a new custom aggregate function that does this. It's pretty straightforward. There are examples in the archives (search for text_concat), but there's also a more modern way involving array_agg and array_to_string. -- Álvaro Herrera The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support