Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita6bd28b

Browse files
committed
Fix failure of btree_gin indexscans with "char" type and </<= operators.
As a result of confusion about whether the "char" type is signed orunsigned, scans for index searches like "col < 'x'" or "col <= 'x'"would start at the middle of the index not the left end, thus missingmany or all of the entries they should find. Fortunately, thisis not a symptom of index corruption. It's only the search logicthat is broken, and we can fix it without unpleasant side-effects.Per report from Jason Kim. This has been wrong since btree_gin'sbeginning, so back-patch to all supported branches.Discussion:https://postgr.es/m/20210810001649.htnltbh7c63re42p@jasonk.me
1 parent72bbff4 commita6bd28b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

‎contrib/btree_gin/btree_gin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ GIN_SUPPORT(bpchar, true, leftmostvalue_text, bpcharcmp)
357357
staticDatum
358358
leftmostvalue_char(void)
359359
{
360-
returnCharGetDatum(SCHAR_MIN);
360+
returnCharGetDatum(0);
361361
}
362362

363363
GIN_SUPPORT(char, false,leftmostvalue_char,btcharcmp)

‎contrib/btree_gin/expected/char.out

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,19 @@ CREATE INDEX idx_char ON test_char USING gin (i);
77
SELECT * FROM test_char WHERE i<'d'::"char" ORDER BY i;
88
i
99
---
10-
(0 rows)
10+
a
11+
b
12+
c
13+
(3 rows)
1114

1215
SELECT * FROM test_char WHERE i<='d'::"char" ORDER BY i;
1316
i
1417
---
15-
(0 rows)
18+
a
19+
b
20+
c
21+
d
22+
(4 rows)
1623

1724
SELECT * FROM test_char WHERE i='d'::"char" ORDER BY i;
1825
i

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp