pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Oscar van Baten <info@oxcro.com>
Cc: pgsql-bugs@lists.postgresql.org, David Rowley <dgrowleyml@gmail.com>
Subject: Re: Bugreport: incorrect result in 16.1 in query with string_agg(distinct+json_build_object
Date: Wed, 03 Jan 2024 13:20:27 -0500
Message-ID: <230221.1704306027@sss.pgh.pa.us> (raw)
In-Reply-To: <CAC+9yuOrYon-TSnK2F7xDDEWAemxapEErOE3KM0QBCJtQtaUYQ@mail.gmail.com>
References: <CAC+9yuPPRxEKBNAA=s7=uktxaOUnOnHT-gCC_kbfdzSA_eQVGw@mail.gmail.com>
	<210176.1704301004@sss.pgh.pa.us>
	<CAC+9yuOrYon-TSnK2F7xDDEWAemxapEErOE3KM0QBCJtQtaUYQ@mail.gmail.com>

Oscar van Baten <info@oxcro.com> writes:
> There you go:

> GroupAggregate  (cost=94.38..128.98 rows=200 width=96)
>   Output: a.id, string_agg(DISTINCT 'val_B'::text, ', '::text),
> (json_agg(json_build_object('val_1', a.id, 'val_2', (SubPlan 1))))::text|

Ah, that gave me the clue I needed (maybe I should have deduced it
from your Subject, but I plead ENOCAFFEINE).  Your query as submitted
doesn't use DISTINCT in the STRING_AGG call, but that's needed to
trigger the bug.  And it is indeed the same bug as #18264: it begins
at the same commit, and David's WIP patch fixes it.

			regards, tom lane





view thread (5+ messages)

Message-ID: <230221.1704306027@sss.pgh.pa.us>
Permalink:  ../230221.1704306027@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/230221.1704306027@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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, info@oxcro.com, dgrowleyml@gmail.com
  Subject: Re: Bugreport: incorrect result in 16.1 in query with string_agg(distinct+json_build_object
  In-Reply-To: <230221.1704306027@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