forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita73952b
committed
Add check on initial and boot values when loading GUCs
This commit adds a function to perform a cross-check between the initialvalue of the C declaration associated to a GUC and its actual bootvalue in assert-enabled builds. The purpose of this is to preventanybody reading these C declarations from being fooled by mismatchedvalues before they are loaded at program startup.The following rules apply depending on the GUC type:* bool - can be false, or same as boot_val.* int - can be 0, or same as the boot_val.* real - can be 0.0, or same as the boot_val.* string - can be NULL, or strcmp'd equal to the boot_val.* enum - equal to the boot_val.This is done for the system as well custom GUCs loaded by externalmodules, which may require extension developers to adapt the Cdeclaration of the variables used by these GUCs (testing this changewith some of my own modules has allowed me to catch some stupid typos,FWIW). This may finish by being a bad experiment depending on thefeedbcak received, but let's see how it goes.Author: Peter SmithReviewed-by: Nathan Bossart, Tom Lane, Michael Paquier, Justin PryzbyDiscussion:https://postgr.es/m/CAHut+PtHE0XSfjjRQ6D4v7+dqzCw=d+1a64ujra4EX8aoc_Z+w@mail.gmail.com1 parentd9d873b commita73952b
1 file changed
+89
-0
lines changedLines changed: 89 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1382 | 1382 |
| |
1383 | 1383 |
| |
1384 | 1384 |
| |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
1385 | 1468 |
| |
1386 | 1469 |
| |
1387 | 1470 |
| |
| |||
1413 | 1496 |
| |
1414 | 1497 |
| |
1415 | 1498 |
| |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
1416 | 1502 |
| |
1417 | 1503 |
| |
1418 | 1504 |
| |
| |||
4654 | 4740 |
| |
4655 | 4741 |
| |
4656 | 4742 |
| |
| 4743 | + | |
| 4744 | + | |
| 4745 | + | |
4657 | 4746 |
| |
4658 | 4747 |
| |
4659 | 4748 |
| |
|
0 commit comments
Comments
(0)