public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Andrey <[email protected]>
Cc: [email protected]
Subject: Re: Unexpected results from a query with UNION ALL
Date: Wed, 08 Jan 2025 12:01:36 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CAOS4yi14bhxXUCZ_CQFeojAvBzAf9FebtjXsvOTm8KdXb8L14Q@mail.gmail.com>
	<[email protected]>

I wrote:
> Andrey <[email protected]> writes:
>> ... but I would expect to get the same result as previously. Is it a bug
>> or am I doing something wrong here?

> It's a surprising result for sure, but I believe it's explained by
> the algorithm for READ COMMITTED [1], specifically the bit about

Actually, on further thought I believe this really is a bug,
because if you change the UNION ALL to UNION it works fine.
It probably used to work with UNION ALL too, but that was a few
decades ago before we started adding optimizations of UNION ALL :-(

I've been poking at this off and on for the last few days, and I've
found three different things that will need to be changed to make
it work again.  At least one of them looks too invasive to consider
for back-patch.  So don't hold your breath for a proper fix, but
perhaps you could use UNION as a workaround?

			regards, tom lane






view thread (4+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Unexpected results from a query with UNION ALL
  In-Reply-To: <[email protected]>

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

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