Re: BUG #18135: Incorrect memory access occurs when attaching a partition with an index
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Date: 2023-09-28T17:31:39Z
Lists: pgsql-bugs
Attachments
- fix-CompareIndexInfo.patch (text/x-diff) patch
PG Bug reporting form <noreply@postgresql.org> writes: > The function CompareIndexInfo() contains the code: > /* ignore expressions at this stage */ > if ((info1->ii_IndexAttrNumbers[i] != InvalidAttrNumber) && > (attmap->attnums[info2->ii_IndexAttrNumbers[i] - 1] != > info1->ii_IndexAttrNumbers[i])) > return false; > where info1->ii_IndexAttrNumbers[i] is checked for InvalidAttrNumber > (i. e. it's not an expression), but info2->ii_IndexAttrNumbers[i] is not. Agreed, that's pretty broken, and it's not just that it risks an invalid access. I don't think this reliably rejects cases where one index has an expression and the other doesn't. Even if it does work, it's way too complicated to convince oneself that that's rejected. I think for clarity we should code it as attached. regards, tom lane
Commits
-
Fix checking of index expressions in CompareIndexInfo().
- 3caedf246123 11.22 landed
- d6425987ba76 12.17 landed
- 9f71e10d65fa 17.0 landed
- 9d6d8d7049ea 14.10 landed
- 83ba050f92fa 13.13 landed
- 59371f1aeb9a 15.5 landed
- 12402b93117b 16.1 landed