pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: jeff@goaldriven.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #10972: string_agg function incorrectly concatenating varying delimiter
Date: Wed, 16 Jul 2014 10:20:02 -0400
Message-ID: <25917.1405520402@sss.pgh.pa.us> (raw)
In-Reply-To: <20140716001632.2502.98836@wrigleys.postgresql.org>
References: <20140716001632.2502.98836@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

jeff@goaldriven.com writes:
> Running the query below will show how the delimiter for the current row is
> actually the subsequent rows delimiter.

Hmm, well, the documentation for string_agg doesn't say what happens when
the "delimiter" argument varies across rows; but a quick look at the code
finds that the first-call delimiter isn't actually used at all, and on
subsequent calls the delimiter is appended to the running result before
the associated value is.  Which seems to me to be at least as reasonable,
and certainly a great deal easier to implement, as what you seem to have
in mind.  Can you offer a principled argument why it should be the other
way around?

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (6+ messages)  latest in thread

Message-ID: <25917.1405520402@sss.pgh.pa.us>
Permalink:  ../25917.1405520402@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25917.1405520402@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jeff@goaldriven.com
  Subject: Re: BUG #10972: string_agg function incorrectly concatenating varying delimiter
  In-Reply-To: <25917.1405520402@sss.pgh.pa.us>
  References: <20140716001632.2502.98836@wrigleys.postgresql.org> <25917.1405520402@sss.pgh.pa.us>

* 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