forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6cbfb78
committed
Rework the pg_statistic_ext catalog
Since extended statistic got introduced in PostgreSQL 10, there was asingle catalog pg_statistic_ext storing both the definitions and builtstatistic. That's however problematic when a user is supposed to haveaccess only to the definitions, but not to user data.Consider for example pg_dump on a database with RLS enabled - if thepg_statistic_ext catalog respects RLS (which it should, if it containsuser data), pg_dump would not see any records and the result would notdefine any extended statistics. That would be a surprising behavior.Until now this was not a pressing issue, because the existing types ofextended statistic (functional dependencies and ndistinct coefficients)do not include any user data directly. This changed with introductionof MCV lists, which do include most common combinations of values.The easiest way to fix this is to split the pg_statistic_ext cataloginto two - one for definitions, one for the built statistic values.The new catalog is called pg_statistic_ext_data, and we're maintaininga 1:1 relationship with the old catalog - either there are matchingrecords in both catalogs, or neither of them.Bumped CATVERSION due to changing system catalog definitions.Author: Dean Rasheed, with improvements by meReviewed-by: Dean Rasheed, John NaylorDiscussion:https://postgr.es/m/CAEZATCUhT9rt7Ui%3DVdx4N%3D%3DVV5XOK5dsXfnGgVOz_JhAicB%3DZA%40mail.gmail.com1 parente3846a0 commit6cbfb78
File tree
25 files changed
+337
-118
lines changed- doc/src/sgml
- src
- backend
- catalog
- commands
- optimizer/util
- statistics
- utils/cache
- include
- catalog
- utils
- test/regress
- expected
- sql
- tools/pgindent
25 files changed
+337
-118
lines changedLines changed: 59 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
297 | 297 |
| |
298 | 298 |
| |
299 | 299 |
| |
300 |
| - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
301 | 306 |
| |
302 | 307 |
| |
303 | 308 |
| |
| |||
6506 | 6511 |
| |
6507 | 6512 |
| |
6508 | 6513 |
| |
6509 |
| - | |
| 6514 | + | |
6510 | 6515 |
| |
6511 | 6516 |
| |
6512 | 6517 |
| |
| |||
6581 | 6586 |
| |
6582 | 6587 |
| |
6583 | 6588 |
| |
| 6589 | + | |
| 6590 | + | |
| 6591 | + | |
| 6592 | + | |
| 6593 | + | |
| 6594 | + | |
| 6595 | + | |
| 6596 | + | |
| 6597 | + | |
| 6598 | + | |
| 6599 | + | |
| 6600 | + | |
| 6601 | + | |
| 6602 | + | |
| 6603 | + | |
| 6604 | + | |
| 6605 | + | |
| 6606 | + | |
| 6607 | + | |
| 6608 | + | |
| 6609 | + | |
| 6610 | + | |
| 6611 | + | |
| 6612 | + | |
| 6613 | + | |
| 6614 | + | |
| 6615 | + | |
| 6616 | + | |
| 6617 | + | |
| 6618 | + | |
| 6619 | + | |
| 6620 | + | |
| 6621 | + | |
| 6622 | + | |
| 6623 | + | |
| 6624 | + | |
| 6625 | + | |
| 6626 | + | |
| 6627 | + | |
| 6628 | + | |
| 6629 | + | |
| 6630 | + | |
| 6631 | + | |
| 6632 | + | |
| 6633 | + | |
| 6634 | + | |
| 6635 | + | |
| 6636 | + | |
| 6637 | + | |
6584 | 6638 |
| |
6585 |
| - | |
| 6639 | + | |
6586 | 6640 |
| |
6587 | 6641 |
| |
6588 | 6642 |
| |
| |||
6591 | 6645 |
| |
6592 | 6646 |
| |
6593 | 6647 |
| |
6594 |
| - | |
| 6648 | + | |
6595 | 6649 |
| |
6596 | 6650 |
| |
6597 | 6651 |
| |
| |||
6601 | 6655 |
| |
6602 | 6656 |
| |
6603 | 6657 |
| |
6604 |
| - | |
| 6658 | + | |
6605 | 6659 |
| |
6606 | 6660 |
| |
6607 | 6661 |
| |
| |||
6614 | 6668 |
| |
6615 | 6669 |
| |
6616 | 6670 |
| |
6617 |
| - | |
6618 |
| - | |
6619 |
| - | |
6620 |
| - | |
6621 |
| - | |
6622 |
| - | |
6623 | 6671 |
| |
6624 | 6672 |
| |
6625 | 6673 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
22427 | 22427 |
| |
22428 | 22428 |
| |
22429 | 22429 |
| |
22430 |
| - | |
22431 |
| - | |
| 22430 | + | |
| 22431 | + | |
22432 | 22432 |
| |
22433 | 22433 |
| |
22434 | 22434 |
| |
22435 |
| - | |
| 22435 | + | |
22436 | 22436 |
| |
22437 | 22437 |
| |
22438 | 22438 |
| |
|
Lines changed: 12 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1076 | 1076 |
| |
1077 | 1077 |
| |
1078 | 1078 |
| |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
1079 | 1083 |
| |
1080 | 1084 |
| |
1081 | 1085 |
| |
| |||
1104 | 1108 |
| |
1105 | 1109 |
| |
1106 | 1110 |
| |
1107 |
| - | |
| 1111 | + | |
1108 | 1112 |
| |
1109 | 1113 |
| |
1110 | 1114 |
| |
| |||
1172 | 1176 |
| |
1173 | 1177 |
| |
1174 | 1178 |
| |
1175 |
| - | |
1176 |
| - | |
| 1179 | + | |
| 1180 | + | |
1177 | 1181 |
| |
1178 |
| - | |
| 1182 | + | |
1179 | 1183 |
| |
1180 | 1184 |
| |
1181 | 1185 |
| |
| |||
1262 | 1266 |
| |
1263 | 1267 |
| |
1264 | 1268 |
| |
1265 |
| - | |
1266 |
| - | |
| 1269 | + | |
| 1270 | + | |
1267 | 1271 |
| |
1268 | 1272 |
| |
1269 | 1273 |
| |
| |||
1317 | 1321 |
| |
1318 | 1322 |
| |
1319 | 1323 |
| |
1320 |
| - | |
1321 |
| - | |
| 1324 | + | |
| 1325 | + | |
1322 | 1326 |
| |
1323 | 1327 |
| |
1324 | 1328 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
635 | 635 |
| |
636 | 636 |
| |
637 | 637 |
| |
638 |
| - | |
639 |
| - | |
| 638 | + | |
| 639 | + | |
640 | 640 |
| |
641 | 641 |
| |
642 | 642 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
34 | 34 |
| |
35 | 35 |
| |
36 | 36 |
| |
37 |
| - | |
| 37 | + | |
38 | 38 |
| |
39 | 39 |
| |
40 | 40 |
| |
|
Lines changed: 56 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
| 26 | + | |
26 | 27 |
| |
27 | 28 |
| |
28 | 29 |
| |
| |||
67 | 68 |
| |
68 | 69 |
| |
69 | 70 |
| |
| 71 | + | |
| 72 | + | |
70 | 73 |
| |
71 | 74 |
| |
| 75 | + | |
72 | 76 |
| |
73 | 77 |
| |
74 | 78 |
| |
| |||
336 | 340 |
| |
337 | 341 |
| |
338 | 342 |
| |
339 |
| - | |
340 |
| - | |
341 |
| - | |
342 |
| - | |
343 |
| - | |
344 | 343 |
| |
345 | 344 |
| |
346 | 345 |
| |
347 | 346 |
| |
348 | 347 |
| |
349 | 348 |
| |
350 | 349 |
| |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
351 | 373 |
| |
352 | 374 |
| |
353 | 375 |
| |
| |||
403 | 425 |
| |
404 | 426 |
| |
405 | 427 |
| |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
406 | 445 |
| |
407 | 446 |
| |
408 | 447 |
| |
| |||
431 | 470 |
| |
432 | 471 |
| |
433 | 472 |
| |
434 |
| - | |
435 |
| - | |
| 473 | + | |
| 474 | + | |
436 | 475 |
| |
437 | 476 |
| |
438 | 477 |
| |
| |||
456 | 495 |
| |
457 | 496 |
| |
458 | 497 |
| |
459 |
| - | |
460 |
| - | |
461 |
| - | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
462 | 501 |
| |
463 |
| - | |
| 502 | + | |
464 | 503 |
| |
465 | 504 |
| |
466 | 505 |
| |
| |||
479 | 518 |
| |
480 | 519 |
| |
481 | 520 |
| |
482 |
| - | |
483 |
| - | |
484 |
| - | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
485 | 524 |
| |
486 |
| - | |
487 |
| - | |
| 525 | + | |
| 526 | + | |
488 | 527 |
| |
489 |
| - | |
| 528 | + | |
490 | 529 |
| |
491 | 530 |
| |
492 | 531 |
| |
|
Lines changed: 9 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1308 | 1308 |
| |
1309 | 1309 |
| |
1310 | 1310 |
| |
| 1311 | + | |
1311 | 1312 |
| |
1312 | 1313 |
| |
1313 | 1314 |
| |
| |||
1316 | 1317 |
| |
1317 | 1318 |
| |
1318 | 1319 |
| |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
1319 | 1324 |
| |
1320 | 1325 |
| |
1321 | 1326 |
| |
| |||
1325 | 1330 |
| |
1326 | 1331 |
| |
1327 | 1332 |
| |
1328 |
| - | |
| 1333 | + | |
1329 | 1334 |
| |
1330 | 1335 |
| |
1331 | 1336 |
| |
| |||
1337 | 1342 |
| |
1338 | 1343 |
| |
1339 | 1344 |
| |
1340 |
| - | |
| 1345 | + | |
1341 | 1346 |
| |
1342 | 1347 |
| |
1343 | 1348 |
| |
| |||
1349 | 1354 |
| |
1350 | 1355 |
| |
1351 | 1356 |
| |
1352 |
| - | |
| 1357 | + | |
1353 | 1358 |
| |
1354 | 1359 |
| |
1355 | 1360 |
| |
| |||
1362 | 1367 |
| |
1363 | 1368 |
| |
1364 | 1369 |
| |
| 1370 | + | |
1365 | 1371 |
| |
1366 | 1372 |
| |
1367 | 1373 |
| |
|
0 commit comments
Comments
(0)