- Notifications
You must be signed in to change notification settings - Fork5
Commit9ad45c1
committed
Fix race condition in enum value comparisons.
When (re) loading the typcache comparison cache for an enum type's values,use an up-to-date MVCC snapshot, not the transaction's existing snapshot.This avoids problems if we encounter an enum OID that was created since ourtransaction started. Per report from Andres Freund and diagnosis by RobertHaas.To ensure this is safe even if enum comparison manages to get invokedbefore we've set a transaction snapshot, tweak GetLatestSnapshot toredirect to GetTransactionSnapshot instead of throwing error whenFirstSnapshotSet is false. The existing uses of GetLatestSnapshot (inri_triggers.c) don't care since they couldn't be invoked except in atransaction that's already done some work --- but it seems just conceivablethat this might not be true of enums, especially if we ever choose to useenums in system catalogs.Note that the comparable coding in enum_endpoint and enum_range_internalremains GetTransactionSnapshot; this is perhaps debatable, but if wechanged it those functions would have to be marked volatile, which doesn'tseem attractive.Back-patch to 9.1 where ALTER TYPE ADD VALUE was added.1 parent39bfc94 commit9ad45c1
2 files changed
+3
-3
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1089 | 1089 |
| |
1090 | 1090 |
| |
1091 | 1091 |
| |
1092 |
| - | |
| 1092 | + | |
1093 | 1093 |
| |
1094 | 1094 |
| |
1095 | 1095 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
196 | 196 |
| |
197 | 197 |
| |
198 | 198 |
| |
199 |
| - | |
| 199 | + | |
200 | 200 |
| |
201 |
| - | |
| 201 | + | |
202 | 202 |
| |
203 | 203 |
| |
204 | 204 |
| |
|
0 commit comments
Comments
(0)