forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitdfd8e6c
committed
Fix an issue with index scan using pg_trgm due to char signedness on different architectures.
GIN and GiST indexes utilizing pg_trgm's opclasses store sortedtrigrams within index tuples. When comparing and sorting each trigram,pg_trgm treats each character as a 'char[3]' type in C. However, thechar type in C can be interpreted as either signed char or unsignedchar, depending on the platform, if the signedness is not explicitlyspecified. Consequently, during replication between different CPUarchitectures, there was an issue where index scans on standby serverscould not locate matching index tuples due to the differing treatmentof character signedness.This change introduces comparison functions for trgm that explicitlyhandle signed char and unsigned char. The appropriate comparisonfunction will be dynamically selected based on the charactersignedness stored in the control file. Therefore, upgraded clusterscan utilize the indexes without rebuilding, provided the clusterupgrade occurs on platforms with the same character signedness as theoriginal cluster initialization.The default char signedness information was introduced in44fe30f,so no backpatch.Reviewed-by: Noah Misch <noah@leadboat.com>Discussion:https://postgr.es/m/CB11ADBC-0C3F-4FE0-A678-666EE80CBB07%40amazon.com1 parent1aab680 commitdfd8e6c
2 files changed
+45
-4
lines changedLines changed: 1 addition & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
43 |
| - | |
44 |
| - | |
45 |
| - | |
46 |
| - | |
47 | 43 |
| |
48 | 44 |
| |
49 | 45 |
| |
50 | 46 |
| |
51 | 47 |
| |
| 48 | + | |
52 | 49 |
| |
53 | 50 |
| |
54 | 51 |
| |
|
Lines changed: 44 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
| 45 | + | |
| 46 | + | |
| 47 | + | |
45 | 48 |
| |
46 | 49 |
| |
47 | 50 |
| |
| |||
107 | 110 |
| |
108 | 111 |
| |
109 | 112 |
| |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
110 | 154 |
| |
111 | 155 |
| |
112 | 156 |
| |
|
0 commit comments
Comments
(0)