Re: BUG #19049: Assert failure when using skip arrays on an index key with DESC order
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: natalya@timescale.com, pgsql-bugs@lists.postgresql.org
Date: 2025-09-12T01:07:02Z
Lists: pgsql-bugs
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Always commute strategy when preprocessing DESC keys.
- 796962922e69 19 (unreleased) landed
- e457312c0d19 18.0 landed
-
Avoid extra index searches through preprocessing.
- b3f1a13f22f9 18.0 cited
On Thu, Sep 11, 2025 at 12:48 PM Peter Geoghegan <pg@bowt.ie> wrote: > I'm going to revisit my test coverage for DESC columns in light of > this issue. I didn't add support for DESC columns in my fuzz testing > scripts, which now seems like an oversight -- I'd definitely have > caught this problem myself, had I done that from the start. Just for the record, I tried this out. Here's what happened: I found that when I introduced alternating ASC/DESC column orders to my existing fuzz testing script, it found the same bug in literally a fraction of a second. I didn't see the same assertion failure that Natalya's test case ran into, though; the script just detected discrepancies between results from an index scan, and an equivalent sequential scan (both for the same randomly generated query). I also found that with my patch was applied, the same fuzz testing script correctly executed several million randomly generated test queries without incident. This includes randomly generated combinations of equality/inequality operators, IS NULL/IS NOT NULL conditions, IN() constructs, and skip arrays. All against either one of a pair of indexes, each with 4 index columns (now with alternating ASC and DESC column orders) -- there are two indexes to cover different permutations of NULLS FIRST and NULLS LAST. The fuzz testing script generates both backwards and forwards scans, for both of these multicolumn indexes. Obviously, this doesn't prove the absence of more DESC column related bugs in the skip scan patchset. But it does make me confident that any remaining DESC column related bugs are bound to be far more subtle/hard to hit than this one was. -- Peter Geoghegan