From: Adam Mackler <AdamMackler@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: Possible Bug in 9.2beta3
Date: Mon, 13 Aug 2012 14:17:00 -0400
Message-ID: <20120813181700.GA45401@bk.macklerlaw.com> (raw)
Hi:
I think I might have found a bug in the 9.2beta3 version. I'm kind of
new to SQL, so forgive me if I'm just misinterpreting correct
behavior. Given the query below, execute it. You should get a
seven-row result.
Next, uncomment the final UNION four lines from the end. When I do
that I then get a two row result. I'm not an expert on recursive
CTEs, but I don't believe a UNION should decrease the number of rows
returned.
Next, change the condition in the final WHERE clause (seven lines from
the end) from "e.row_type='false'" to just "false". Again, I'm not an
expert but my understanding is that any boolean expression returning
false should be equivalent in a given WHERE clause, and you can see
there's no row_type column with value 'false'.
If this is not a bug and I'm just confused, then I apologize and would
greatly appreciate any suggestions as to what I could read that would
unconfuse me. Otherwise, let me know if you need any other details
about my environment. Thanks very much. -Adam Mackler
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
WITH RECURSIVE
tab(id_key,link) AS ( VALUES (1,17), (2,17), (3,17), (4,17), (6,17), (5,17) ),
iter (id_key, row_type, link) AS (
SELECT 0, 'base', 17
UNION(
WITH remaining(id_key, row_type, link, min) AS (
SELECT tab.id_key, 'true'::text, iter.link, MIN(tab.id_key) OVER ()
FROM tab INNER JOIN iter USING (link)
WHERE tab.id_key > iter.id_key
),
first_remaining AS (
SELECT id_key, row_type, link
FROM remaining
WHERE id_key=min
),
effect AS (
SELECT tab.id_key, 'new'::text, tab.link
FROM first_remaining e INNER JOIN tab ON e.id_key=tab.id_key
/* Try changing this WHERE clause to other false expressions */
WHERE e.row_type='false'
)
SELECT * FROM first_remaining
/* Try uncommenting the next line */
--UNION SELECT * FROM effect
)
)
SELECT DISTINCT * FROM iter
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: AdamMackler@gmail.com
Subject: Re: Possible Bug in 9.2beta3
In-Reply-To: <20120813181700.GA45401@bk.macklerlaw.com>
References: <20120813181700.GA45401@bk.macklerlaw.com>
* 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