pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: John Gage <jsmgage@numericable.fr>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: How do you do the opposite of regexp_split_to_table?
Date: Tue, 03 Aug 2010 16:35:26 -0400
Message-ID: <1280867576-sup-2555@alvh.no-ip.org> (raw)
In-Reply-To: <4FA8D090-F145-485B-9062-7136CB8B6CB0@numericable.fr>
References: <4FA8D090-F145-485B-9062-7136CB8B6CB0@numericable.fr>

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 <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



view thread (2+ messages)

Message-ID: <1280867576-sup-2555@alvh.no-ip.org>
Permalink:  ../1280867576-sup-2555@alvh.no-ip.org/
Also on:    postgresql.org/message-id/1280867576-sup-2555@alvh.no-ip.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: alvherre@commandprompt.com, jsmgage@numericable.fr
  Subject: Re: How do you do the opposite of regexp_split_to_table?
  In-Reply-To: <1280867576-sup-2555@alvh.no-ip.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox