BUG #17671: Query returns unexpected result

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: niko(at)aku(dot)mx
Subject: BUG #17671: Query returns unexpected result
Date: 2022-10-31 05:15:44
Message-ID: 17671-d6cc9b68691a264e@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17671
Logged by: Nikola Mirkov
Email address: niko(at)aku(dot)mx
PostgreSQL version: 12.12
Operating system: Ubuntu 12.12-0ubuntu0.20.
Description:

Hey guys,
When I run the following query:
SELECT foo, bar
FROM table1
WHERE fk_id = 637
AND utc > '2022-10-16'
UNION
SELECT foo, bar
FROM table2
WHERE fk_id = 637
AND utc > '2022-10-16'

I'm getting only one row per table. If I add the column "utc" to the list in
SELECT, I get the expected result.

Why is this happening?

Thank you so much!
Niko

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2022-10-31 07:36:19 BUG #17672: Wrong logic of Postgresql Resporitory Naming and mirroring incompatibility
Previous Message Erki Eessaar 2022-10-30 19:10:10 Re: Problem with Avg function and Money type in PostgreSQL 15