forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3e91dba
committed
Fix various issues with ALTER TEXT SEARCH CONFIGURATION
This commit addresses a set of issues when changing token type mappingsin a text search configuration when using duplicated token names:- ADD MAPPING would fail on insertion because of a constraint failureafter inserting the same mapping.- ALTER MAPPING with an "overridden" configuration failed with "tuplealready updated by self" when the token mappings are removed.- DROP MAPPING failed with "tuple already updated by self", likepreviously, but in a different code path.The code is refactored so the token names (with their numbers) arehandled as a List with unique members rather than an array with numbers,ensuring that no duplicates mess up with the catalog inserts, updatesand deletes. The list is generated by getTokenTypes(), with the sameerror handling as previously while duplicated tokens are discarded fromthe list used to work on the catalogs.Regression tests are expanded to cover much more ground for the casesfixed by this commit, as there was no coverage for the code touched inthis commit. A bit more is done regarding the fact that a token namenot supported by a configuration's parser should result in an error evenif IF EXISTS is used in a DROP MAPPING clause. This is implied in thecode but there was no coverage for that, and it was very easy to miss.These issues exist since at least their introduction in core with140d4eb, so backpatch all the way down.Reported-by: Alexander LakhinAuthor: Tender Wang, Michael PaquierDiscussion:https://postgr.es/m/18310-1eb233c5908189c8@postgresql.orgBackpatch-through: 121 parent6ee26c6 commit3e91dba
File tree
4 files changed
+132
-30
lines changed- src
- backend/commands
- test/regress
- expected
- sql
- tools/pgindent
4 files changed
+132
-30
lines changedLines changed: 67 additions & 30 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
51 | 57 |
| |
52 | 58 |
| |
53 | 59 |
| |
| |||
1192 | 1198 |
| |
1193 | 1199 |
| |
1194 | 1200 |
| |
1195 |
| - | |
| 1201 | + | |
1196 | 1202 |
| |
1197 |
| - | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
1198 | 1229 |
| |
1199 | 1230 |
| |
1200 | 1231 |
| |
1201 | 1232 |
| |
1202 |
| - | |
1203 |
| - | |
1204 |
| - | |
| 1233 | + | |
| 1234 | + | |
1205 | 1235 |
| |
1206 | 1236 |
| |
1207 | 1237 |
| |
1208 | 1238 |
| |
1209 |
| - | |
1210 |
| - | |
| 1239 | + | |
1211 | 1240 |
| |
1212 | 1241 |
| |
1213 | 1242 |
| |
| |||
1217 | 1246 |
| |
1218 | 1247 |
| |
1219 | 1248 |
| |
1220 |
| - | |
1221 | 1249 |
| |
1222 | 1250 |
| |
1223 | 1251 |
| |
1224 | 1252 |
| |
1225 | 1253 |
| |
1226 | 1254 |
| |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
1227 | 1259 |
| |
1228 | 1260 |
| |
1229 | 1261 |
| |
1230 | 1262 |
| |
1231 | 1263 |
| |
1232 |
| - | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
1233 | 1269 |
| |
1234 | 1270 |
| |
1235 | 1271 |
| |
| |||
1240 | 1276 |
| |
1241 | 1277 |
| |
1242 | 1278 |
| |
1243 |
| - | |
1244 | 1279 |
| |
1245 | 1280 |
| |
1246 |
| - | |
| 1281 | + | |
1247 | 1282 |
| |
1248 | 1283 |
| |
1249 | 1284 |
| |
| |||
1261 | 1296 |
| |
1262 | 1297 |
| |
1263 | 1298 |
| |
1264 |
| - | |
1265 |
| - | |
| 1299 | + | |
| 1300 | + | |
1266 | 1301 |
| |
1267 | 1302 |
| |
1268 | 1303 |
| |
| |||
1273 | 1308 |
| |
1274 | 1309 |
| |
1275 | 1310 |
| |
1276 |
| - | |
| 1311 | + | |
1277 | 1312 |
| |
1278 | 1313 |
| |
1279 | 1314 |
| |
1280 | 1315 |
| |
1281 | 1316 |
| |
1282 | 1317 |
| |
1283 |
| - | |
| 1318 | + | |
1284 | 1319 |
| |
| 1320 | + | |
| 1321 | + | |
1285 | 1322 |
| |
1286 | 1323 |
| |
1287 | 1324 |
| |
1288 | 1325 |
| |
1289 | 1326 |
| |
1290 | 1327 |
| |
1291 | 1328 |
| |
1292 |
| - | |
| 1329 | + | |
1293 | 1330 |
| |
1294 | 1331 |
| |
1295 | 1332 |
| |
| |||
1346 | 1383 |
| |
1347 | 1384 |
| |
1348 | 1385 |
| |
1349 |
| - | |
| 1386 | + | |
1350 | 1387 |
| |
1351 |
| - | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
1352 | 1391 |
| |
1353 | 1392 |
| |
1354 | 1393 |
| |
| |||
1401 | 1440 |
| |
1402 | 1441 |
| |
1403 | 1442 |
| |
1404 |
| - | |
| 1443 | + | |
1405 | 1444 |
| |
| 1445 | + | |
| 1446 | + | |
1406 | 1447 |
| |
1407 | 1448 |
| |
1408 | 1449 |
| |
| |||
1411 | 1452 |
| |
1412 | 1453 |
| |
1413 | 1454 |
| |
1414 |
| - | |
| 1455 | + | |
1415 | 1456 |
| |
1416 | 1457 |
| |
1417 | 1458 |
| |
| |||
1455 | 1496 |
| |
1456 | 1497 |
| |
1457 | 1498 |
| |
1458 |
| - | |
1459 | 1499 |
| |
1460 |
| - | |
| 1500 | + | |
1461 | 1501 |
| |
1462 | 1502 |
| |
1463 | 1503 |
| |
| |||
1466 | 1506 |
| |
1467 | 1507 |
| |
1468 | 1508 |
| |
1469 |
| - | |
1470 |
| - | |
| 1509 | + | |
1471 | 1510 |
| |
1472 |
| - | |
| 1511 | + | |
1473 | 1512 |
| |
1474 | 1513 |
| |
1475 | 1514 |
| |
| |||
1479 | 1518 |
| |
1480 | 1519 |
| |
1481 | 1520 |
| |
1482 |
| - | |
| 1521 | + | |
1483 | 1522 |
| |
1484 | 1523 |
| |
1485 | 1524 |
| |
| |||
1499 | 1538 |
| |
1500 | 1539 |
| |
1501 | 1540 |
| |
1502 |
| - | |
| 1541 | + | |
1503 | 1542 |
| |
1504 | 1543 |
| |
1505 | 1544 |
| |
1506 | 1545 |
| |
1507 | 1546 |
| |
1508 |
| - | |
| 1547 | + | |
1509 | 1548 |
| |
1510 | 1549 |
| |
1511 |
| - | |
1512 |
| - | |
1513 | 1550 |
| |
1514 | 1551 |
| |
1515 | 1552 |
| |
|
Lines changed: 34 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
687 | 687 |
| |
688 | 688 |
| |
689 | 689 |
| |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + |
Lines changed: 30 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
251 | 251 |
| |
252 | 252 |
| |
253 | 253 |
| |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2758 | 2758 |
| |
2759 | 2759 |
| |
2760 | 2760 |
| |
| 2761 | + | |
2761 | 2762 |
| |
2762 | 2763 |
| |
2763 | 2764 |
| |
|
0 commit comments
Comments
(0)