You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"payload":{"commit":{"oid":"34479d9a36a280afe1387146871d4c1528cf2cbf","url":"/postgres/postgres/commit/34479d9a36a280afe1387146871d4c1528cf2cbf","authoredDate":"2018-07-19T08:20:59.000+02:00","committedDate":"2018-11-10T16:14:51.000+01:00","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003eRemove dead foreign key optimization code\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"The ri_KeysEqual() calls in the foreign-key trigger functions to\noptimize away some updates are useless because since\n\u003ca class=\"commit-link\" data-hovercard-type=\"commit\" data-hovercard-url=\"https://github.com/postgres/postgres/commit/adfeef55cbcc5dc72a772777f88c1be05a70dfee/hovercard\" href=\"https://github.com/postgres/postgres/commit/adfeef55cbcc5dc72a772777f88c1be05a70dfee\"\u003e\u003ctt\u003eadfeef5\u003c/tt\u003e\u003c/a\u003e those triggers are not enqueued\nat all. (It's also not useful to keep these checks as some kind of\nbackstop, since it's also semantically correct to just run the full\ncheck even with equal keys.)\n\nReviewed-by: Daniel Gustafsson \u0026lt;daniel@yesql.se\u0026gt;","authors":[{"login":"petere","displayName":"Peter Eisentraut","avatarUrl":"https://avatars.githubusercontent.com/u/105543?v=4","path":"/petere","isGitHub":false}],"committerAttribution":false,"committer":{"login":"petere","displayName":"Peter Eisentraut","avatarUrl":"https://avatars.githubusercontent.com/u/105543?v=4","path":"/petere","isGitHub":false},"parents":["5fde047f2b41e71706d4ea9e8eb0a401f64192c1"],"globalRelayId":"MDY6Q29tbWl0OTI3NDQyOjM0NDc5ZDlhMzZhMjgwYWZlMTM4NzE0Njg3MWQ0YzE1MjhjZjJjYmY=","sha1":"5fde047f2b41e71706d4ea9e8eb0a401f64192c1","sha2":"34479d9a36a280afe1387146871d4c1528cf2cbf"},"currentUser":null,"repo":{"id":927442,"defaultBranch":"master","name":"postgres","ownerLogin":"postgres","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2010-09-21T11:35:45.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/177543?v=4","public":true,"private":false,"isOrgOwned":true},"diffEntryData":[{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":743,"text":"@@ -744,20 +744,6 @@ ri_restrict(TriggerData *trigdata, bool is_no_action)","html":"@@ -744,20 +744,6 @@ ri_restrict(TriggerData *trigdata, bool is_no_action)","displayNoNewLineWarning":false,"position":0,"left":743,"right":743},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":744,"text":" \t\t\t\t\tbreak;","html":" \t\t\t\t\t\u003cspan class=pl-k\u003ebreak\u003c/span\u003e;","displayNoNewLineWarning":false,"position":1,"left":744,"right":744},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":745,"text":" \t\t\t}","html":" \t\t\t}","displayNoNewLineWarning":false,"position":2,"left":745,"right":745},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":746,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":3,"left":746,"right":746},{"stylingDirective":null,"type":"DELETION","blobLineNumber":747,"text":"-\t\t\t/*","html":"-\t\t\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":747,"right":746},{"stylingDirective":null,"type":"DELETION","blobLineNumber":748,"text":"-\t\t\t * In UPDATE, no need to do anything if old and new keys are equal","html":"-\u003cspan class=pl-c\u003e\t\t\t * In UPDATE, no need to do anything if old and new keys are equal\u003c/span\u003e","displayNoNewLineWarning":false,"position":5,"left":748,"right":746},{"stylingDirective":null,"type":"DELETION","blobLineNumber":749,"text":"-\t\t\t */","html":"-\u003cspan class=pl-c\u003e\t\t\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":6,"left":749,"right":746},{"stylingDirective":null,"type":"DELETION","blobLineNumber":750,"text":"-\t\t\tif (TRIGGER_FIRED_BY_UPDATE(trigdata-\u003etg_event))","html":"-\t\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eTRIGGER_FIRED_BY_UPDATE\u003c/span\u003e(\u003cspan class=pl-s1\u003etrigdata\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003etg_event\u003c/span\u003e))","displayNoNewLineWarning":false,"position":7,"left":750,"right":746},{"stylingDirective":null,"type":"DELETION","blobLineNumber":751,"text":"-\t\t\t{","html":"-\t\t\t{","displayNoNewLineWarning":false,"position":8,"left":751,"right":746},{"stylingDirective":null,"type":"DELETION","blobLineNumber":752,"text":"-\t\t\t\tHeapTuple\tnew_row = trigdata-\u003etg_newtuple;","html":"-\t\t\t\t\u003cspan class=pl-smi\u003eHeapTuple\u003c/span\u003e\t\u003cspan class=pl-s1\u003enew_row\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003etrigdata\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003etg_newtuple\u003c/span\u003e;","displayNoNewLineWarning":false,"position":9,"left":752,"right":746},{"stylingDirective":null,"type":"DELETION","blobLineNumber":753,"text":"-","html":"-","displayNoNewLineWarning":false,"position":10,"left":753,"right":746},{"stylingDirective":null,"type":"DELETION","blobLineNumber":754,"text":"-\t\t\t\tif (ri_KeysEqual(pk_rel, old_row, new_row, riinfo, true))","html":"-\t\t\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eri_KeysEqual\u003c/span\u003e(\u003cspan class=pl-s1\u003epk_rel\u003c/span\u003e, \u003cspan class=pl-s1\u003eold_row\u003c/span\u003e, \u003cspan class=pl-s1\u003enew_row\u003c/span\u003e, \u003cspan class=pl-s1\u003eriinfo\u003c/span\u003e, true))","displayNoNewLineWarning":false,"position":11,"left":754,"right":746},{"stylingDirective":null,"type":"DELETION","blobLineNumber":755,"text":"-\t\t\t\t{","html":"-\t\t\t\t{","displayNoNewLineWarning":false,"position":12,"left":755,"right":746},{"stylingDirective":null,"type":"DELETION","blobLineNumber":756,"text":"-\t\t\t\t\theap_close(fk_rel, RowShareLock);","html":"-\t\t\t\t\t\u003cspan class=pl-en\u003eheap_close\u003c/span\u003e(\u003cspan class=pl-s1\u003efk_rel\u003c/span\u003e, \u003cspan class=pl-s1\u003eRowShareLock\u003c/span\u003e);","displayNoNewLineWarning":false,"position":13,"left":756,"right":746},{"stylingDirective":null,"type":"DELETION","blobLineNumber":757,"text":"-\t\t\t\t\treturn PointerGetDatum(NULL);","html":"-\t\t\t\t\t\u003cspan class=pl-k\u003ereturn\u003c/span\u003e \u003cspan class=pl-en\u003ePointerGetDatum\u003c/span\u003e(\u003cspan class=pl-c1\u003eNULL\u003c/span\u003e);","displayNoNewLineWarning":false,"position":14,"left":757,"right":746},{"stylingDirective":null,"type":"DELETION","blobLineNumber":758,"text":"-\t\t\t\t}","html":"-\t\t\t\t}","displayNoNewLineWarning":false,"position":15,"left":758,"right":746},{"stylingDirective":null,"type":"DELETION","blobLineNumber":759,"text":"-\t\t\t}","html":"-\t\t\t}","displayNoNewLineWarning":false,"position":16,"left":759,"right":746},{"stylingDirective":null,"type":"DELETION","blobLineNumber":760,"text":"-","html":"-","displayNoNewLineWarning":false,"position":17,"left":760,"right":746},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":747,"text":" \t\t\t/*","html":" \t\t\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":18,"left":761,"right":747},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":748,"text":" \t\t\t * If another PK row now exists providing the old key values, we","html":" \u003cspan class=pl-c\u003e\t\t\t * If another PK row now exists providing the old key values, we\u003c/span\u003e","displayNoNewLineWarning":false,"position":19,"left":762,"right":748},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":749,"text":" \t\t\t * should not do anything. However, this check should only be","html":" \u003cspan class=pl-c\u003e\t\t\t * should not do anything. However, this check should only be\u003c/span\u003e","displayNoNewLineWarning":false,"position":20,"left":763,"right":749},{"stylingDirective":null,"type":"HUNK","blobLineNumber":1083,"text":"@@ -1098,15 +1084,6 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS)","html":"@@ -1098,15 +1084,6 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS)","displayNoNewLineWarning":false,"position":21,"left":1097,"right":1083},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1084,"text":" \t\t\t\t\tbreak;","html":" \t\t\t\t\t\u003cspan class=pl-k\u003ebreak\u003c/span\u003e;","displayNoNewLineWarning":false,"position":22,"left":1098,"right":1084},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1085,"text":" \t\t\t}","html":" \t\t\t}","displayNoNewLineWarning":false,"position":23,"left":1099,"right":1085},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1086,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":24,"left":1100,"right":1086},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1101,"text":"-\t\t\t/*","html":"-\t\t\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":25,"left":1101,"right":1086},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1102,"text":"-\t\t\t * No need to do anything if old and new keys are equal","html":"-\u003cspan class=pl-c\u003e\t\t\t * No need to do anything if old and new keys are equal\u003c/span\u003e","displayNoNewLineWarning":false,"position":26,"left":1102,"right":1086},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1103,"text":"-\t\t\t */","html":"-\u003cspan class=pl-c\u003e\t\t\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":27,"left":1103,"right":1086},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1104,"text":"-\t\t\tif (ri_KeysEqual(pk_rel, old_row, new_row, riinfo, true))","html":"-\t\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eri_KeysEqual\u003c/span\u003e(\u003cspan class=pl-s1\u003epk_rel\u003c/span\u003e, \u003cspan class=pl-s1\u003eold_row\u003c/span\u003e, \u003cspan class=pl-s1\u003enew_row\u003c/span\u003e, \u003cspan class=pl-s1\u003eriinfo\u003c/span\u003e, true))","displayNoNewLineWarning":false,"position":28,"left":1104,"right":1086},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1105,"text":"-\t\t\t{","html":"-\t\t\t{","displayNoNewLineWarning":false,"position":29,"left":1105,"right":1086},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1106,"text":"-\t\t\t\theap_close(fk_rel, RowExclusiveLock);","html":"-\t\t\t\t\u003cspan class=pl-en\u003eheap_close\u003c/span\u003e(\u003cspan class=pl-s1\u003efk_rel\u003c/span\u003e, \u003cspan class=pl-s1\u003eRowExclusiveLock\u003c/span\u003e);","displayNoNewLineWarning":false,"position":30,"left":1106,"right":1086},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1107,"text":"-\t\t\t\treturn PointerGetDatum(NULL);","html":"-\t\t\t\t\u003cspan class=pl-k\u003ereturn\u003c/span\u003e \u003cspan class=pl-en\u003ePointerGetDatum\u003c/span\u003e(\u003cspan class=pl-c1\u003eNULL\u003c/span\u003e);","displayNoNewLineWarning":false,"position":31,"left":1107,"right":1086},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1108,"text":"-\t\t\t}","html":"-\t\t\t}","displayNoNewLineWarning":false,"position":32,"left":1108,"right":1086},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1109,"text":"-","html":"-","displayNoNewLineWarning":false,"position":33,"left":1109,"right":1086},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1087,"text":" \t\t\tif (SPI_connect() != SPI_OK_CONNECT)","html":" \t\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eSPI_connect\u003c/span\u003e() \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003eSPI_OK_CONNECT\u003c/span\u003e)","displayNoNewLineWarning":false,"position":34,"left":1110,"right":1087},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1088,"text":" \t\t\t\telog(ERROR, \"SPI_connect failed\");","html":" \t\t\t\t\u003cspan class=pl-en\u003eelog\u003c/span\u003e(\u003cspan class=pl-c1\u003eERROR\u003c/span\u003e, \u003cspan class=pl-s\u003e\u0026quot;SPI_connect failed\u0026quot;\u003c/span\u003e);","displayNoNewLineWarning":false,"position":35,"left":1111,"right":1088},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1089,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":36,"left":1112,"right":1089},{"stylingDirective":null,"type":"HUNK","blobLineNumber":1292,"text":"@@ -1316,20 +1293,6 @@ ri_setnull(TriggerData *trigdata)","html":"@@ -1316,20 +1293,6 @@ ri_setnull(TriggerData *trigdata)","displayNoNewLineWarning":false,"position":37,"left":1315,"right":1292},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1293,"text":" \t\t\t\t\tbreak;","html":" \t\t\t\t\t\u003cspan class=pl-k\u003ebreak\u003c/span\u003e;","displayNoNewLineWarning":false,"position":38,"left":1316,"right":1293},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1294,"text":" \t\t\t}","html":" \t\t\t}","displayNoNewLineWarning":false,"position":39,"left":1317,"right":1294},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1295,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":40,"left":1318,"right":1295},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1319,"text":"-\t\t\t/*","html":"-\t\t\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":41,"left":1319,"right":1295},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1320,"text":"-\t\t\t * In UPDATE, no need to do anything if old and new keys are equal","html":"-\u003cspan class=pl-c\u003e\t\t\t * In UPDATE, no need to do anything if old and new keys are equal\u003c/span\u003e","displayNoNewLineWarning":false,"position":42,"left":1320,"right":1295},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1321,"text":"-\t\t\t */","html":"-\u003cspan class=pl-c\u003e\t\t\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":43,"left":1321,"right":1295},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1322,"text":"-\t\t\tif (TRIGGER_FIRED_BY_UPDATE(trigdata-\u003etg_event))","html":"-\t\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eTRIGGER_FIRED_BY_UPDATE\u003c/span\u003e(\u003cspan class=pl-s1\u003etrigdata\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003etg_event\u003c/span\u003e))","displayNoNewLineWarning":false,"position":44,"left":1322,"right":1295},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1323,"text":"-\t\t\t{","html":"-\t\t\t{","displayNoNewLineWarning":false,"position":45,"left":1323,"right":1295},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1324,"text":"-\t\t\t\tHeapTuple\tnew_row = trigdata-\u003etg_newtuple;","html":"-\t\t\t\t\u003cspan class=pl-smi\u003eHeapTuple\u003c/span\u003e\t\u003cspan class=pl-s1\u003enew_row\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003etrigdata\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003etg_newtuple\u003c/span\u003e;","displayNoNewLineWarning":false,"position":46,"left":1324,"right":1295},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1325,"text":"-","html":"-","displayNoNewLineWarning":false,"position":47,"left":1325,"right":1295},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1326,"text":"-\t\t\t\tif (ri_KeysEqual(pk_rel, old_row, new_row, riinfo, true))","html":"-\t\t\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eri_KeysEqual\u003c/span\u003e(\u003cspan class=pl-s1\u003epk_rel\u003c/span\u003e, \u003cspan class=pl-s1\u003eold_row\u003c/span\u003e, \u003cspan class=pl-s1\u003enew_row\u003c/span\u003e, \u003cspan class=pl-s1\u003eriinfo\u003c/span\u003e, true))","displayNoNewLineWarning":false,"position":48,"left":1326,"right":1295},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1327,"text":"-\t\t\t\t{","html":"-\t\t\t\t{","displayNoNewLineWarning":false,"position":49,"left":1327,"right":1295},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1328,"text":"-\t\t\t\t\theap_close(fk_rel, RowExclusiveLock);","html":"-\t\t\t\t\t\u003cspan class=pl-en\u003eheap_close\u003c/span\u003e(\u003cspan class=pl-s1\u003efk_rel\u003c/span\u003e, \u003cspan class=pl-s1\u003eRowExclusiveLock\u003c/span\u003e);","displayNoNewLineWarning":false,"position":50,"left":1328,"right":1295},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1329,"text":"-\t\t\t\t\treturn PointerGetDatum(NULL);","html":"-\t\t\t\t\t\u003cspan class=pl-k\u003ereturn\u003c/span\u003e \u003cspan class=pl-en\u003ePointerGetDatum\u003c/span\u003e(\u003cspan class=pl-c1\u003eNULL\u003c/span\u003e);","displayNoNewLineWarning":false,"position":51,"left":1329,"right":1295},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1330,"text":"-\t\t\t\t}","html":"-\t\t\t\t}","displayNoNewLineWarning":false,"position":52,"left":1330,"right":1295},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1331,"text":"-\t\t\t}","html":"-\t\t\t}","displayNoNewLineWarning":false,"position":53,"left":1331,"right":1295},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1332,"text":"-","html":"-","displayNoNewLineWarning":false,"position":54,"left":1332,"right":1295},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1296,"text":" \t\t\tif (SPI_connect() != SPI_OK_CONNECT)","html":" \t\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eSPI_connect\u003c/span\u003e() \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003eSPI_OK_CONNECT\u003c/span\u003e)","displayNoNewLineWarning":false,"position":55,"left":1333,"right":1296},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1297,"text":" \t\t\t\telog(ERROR, \"SPI_connect failed\");","html":" \t\t\t\t\u003cspan class=pl-en\u003eelog\u003c/span\u003e(\u003cspan class=pl-c1\u003eERROR\u003c/span\u003e, \u003cspan class=pl-s\u003e\u0026quot;SPI_connect failed\u0026quot;\u003c/span\u003e);","displayNoNewLineWarning":false,"position":56,"left":1334,"right":1297},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1298,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":57,"left":1335,"right":1298},{"stylingDirective":null,"type":"HUNK","blobLineNumber":1498,"text":"@@ -1536,20 +1499,6 @@ ri_setdefault(TriggerData *trigdata)","html":"@@ -1536,20 +1499,6 @@ ri_setdefault(TriggerData *trigdata)","displayNoNewLineWarning":false,"position":58,"left":1535,"right":1498},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1499,"text":" \t\t\t\t\tbreak;","html":" \t\t\t\t\t\u003cspan class=pl-k\u003ebreak\u003c/span\u003e;","displayNoNewLineWarning":false,"position":59,"left":1536,"right":1499},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1500,"text":" \t\t\t}","html":" \t\t\t}","displayNoNewLineWarning":false,"position":60,"left":1537,"right":1500},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1501,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":61,"left":1538,"right":1501},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1539,"text":"-\t\t\t/*","html":"-\t\t\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":62,"left":1539,"right":1501},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1540,"text":"-\t\t\t * In UPDATE, no need to do anything if old and new keys are equal","html":"-\u003cspan class=pl-c\u003e\t\t\t * In UPDATE, no need to do anything if old and new keys are equal\u003c/span\u003e","displayNoNewLineWarning":false,"position":63,"left":1540,"right":1501},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1541,"text":"-\t\t\t */","html":"-\u003cspan class=pl-c\u003e\t\t\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":64,"left":1541,"right":1501},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1542,"text":"-\t\t\tif (TRIGGER_FIRED_BY_UPDATE(trigdata-\u003etg_event))","html":"-\t\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eTRIGGER_FIRED_BY_UPDATE\u003c/span\u003e(\u003cspan class=pl-s1\u003etrigdata\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003etg_event\u003c/span\u003e))","displayNoNewLineWarning":false,"position":65,"left":1542,"right":1501},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1543,"text":"-\t\t\t{","html":"-\t\t\t{","displayNoNewLineWarning":false,"position":66,"left":1543,"right":1501},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1544,"text":"-\t\t\t\tHeapTuple\tnew_row = trigdata-\u003etg_newtuple;","html":"-\t\t\t\t\u003cspan class=pl-smi\u003eHeapTuple\u003c/span\u003e\t\u003cspan class=pl-s1\u003enew_row\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-s1\u003etrigdata\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003etg_newtuple\u003c/span\u003e;","displayNoNewLineWarning":false,"position":67,"left":1544,"right":1501},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1545,"text":"-","html":"-","displayNoNewLineWarning":false,"position":68,"left":1545,"right":1501},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1546,"text":"-\t\t\t\tif (ri_KeysEqual(pk_rel, old_row, new_row, riinfo, true))","html":"-\t\t\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eri_KeysEqual\u003c/span\u003e(\u003cspan class=pl-s1\u003epk_rel\u003c/span\u003e, \u003cspan class=pl-s1\u003eold_row\u003c/span\u003e, \u003cspan class=pl-s1\u003enew_row\u003c/span\u003e, \u003cspan class=pl-s1\u003eriinfo\u003c/span\u003e, true))","displayNoNewLineWarning":false,"position":69,"left":1546,"right":1501},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1547,"text":"-\t\t\t\t{","html":"-\t\t\t\t{","displayNoNewLineWarning":false,"position":70,"left":1547,"right":1501},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1548,"text":"-\t\t\t\t\theap_close(fk_rel, RowExclusiveLock);","html":"-\t\t\t\t\t\u003cspan class=pl-en\u003eheap_close\u003c/span\u003e(\u003cspan class=pl-s1\u003efk_rel\u003c/span\u003e, \u003cspan class=pl-s1\u003eRowExclusiveLock\u003c/span\u003e);","displayNoNewLineWarning":false,"position":71,"left":1548,"right":1501},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1549,"text":"-\t\t\t\t\treturn PointerGetDatum(NULL);","html":"-\t\t\t\t\t\u003cspan class=pl-k\u003ereturn\u003c/span\u003e \u003cspan class=pl-en\u003ePointerGetDatum\u003c/span\u003e(\u003cspan class=pl-c1\u003eNULL\u003c/span\u003e);","displayNoNewLineWarning":false,"position":72,"left":1549,"right":1501},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1550,"text":"-\t\t\t\t}","html":"-\t\t\t\t}","displayNoNewLineWarning":false,"position":73,"left":1550,"right":1501},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1551,"text":"-\t\t\t}","html":"-\t\t\t}","displayNoNewLineWarning":false,"position":74,"left":1551,"right":1501},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1552,"text":"-","html":"-","displayNoNewLineWarning":false,"position":75,"left":1552,"right":1501},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1502,"text":" \t\t\tif (SPI_connect() != SPI_OK_CONNECT)","html":" \t\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003eSPI_connect\u003c/span\u003e() \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003eSPI_OK_CONNECT\u003c/span\u003e)","displayNoNewLineWarning":false,"position":76,"left":1553,"right":1502},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1503,"text":" \t\t\t\telog(ERROR, \"SPI_connect failed\");","html":" \t\t\t\t\u003cspan class=pl-en\u003eelog\u003c/span\u003e(\u003cspan class=pl-c1\u003eERROR\u003c/span\u003e, \u003cspan class=pl-s\u003e\u0026quot;SPI_connect failed\u0026quot;\u003c/span\u003e);","displayNoNewLineWarning":false,"position":77,"left":1554,"right":1503},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1504,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":78,"left":1555,"right":1504}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":3205,"linesChanged":51,"newTreeEntry":{"lineCount":3205,"path":"src/backend/utils/adt/ri_triggers.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/backend/utils/adt/ri_triggers.c","mode":100644},"linesAdded":0,"linesDeleted":51,"path":"src/backend/utils/adt/ri_triggers.c","pathDigest":"f7878872c40c173d30d56c0e9a0346a49594ba66207d3204d6d4b22108122e22","status":"MODIFIED","truncatedReason":null,"oldOid":"5fde047f2b41e71706d4ea9e8eb0a401f64192c1","newOid":"34479d9a36a280afe1387146871d4c1528cf2cbf","copilotChatReference":null,"deletedSha":"5fde047f2b41e71706d4ea9e8eb0a401f64192c1","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null}],"splitViewPreference":"unified","ignoreWhitespace":false,"repoOwnerGlobalRelayId":"MDEyOk9yZ2FuaXphdGlvbjE3NzU0Mw==","commentsPreference":"visible","diffLineSpacingPreference":"relaxed","useMonospaceFont":false,"pasteUrlLinkAsPlainText":false,"userNotices":[],"path":"/postgres/postgres/commit/34479d9a36a280afe1387146871d4c1528cf2cbf","fileTreeExpanded":true,"headerInfo":{"additions":0,"deletions":51,"filesChanged":1,"filesChangedString":"1"},"moreDiffsToLoad":false,"asyncDiffLoadInfo":{"startIndex":1,"truncated":false,"byteCount":2033,"lineShownCount":79},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"C0q4Bj4tvxbjDAxZfEXTJ3t8NxcZpCMOEkmPj-bRLXJjTb_sSHm4-mtw9HVtdDlvqTWRuH3kAWXenyh1m9Nt8g"},"/users/diffview?diff=unified":{"post":"DzgUzUbf9Gc0c_s71Ks4UstJXxLfskLjxmN5R5_c23BnPxMnMIvzi7wPAxfFmtIaGQD5vbvyYIgKtd694t6b8A"},"/notifications/thread":{"post":"ISXEBIpCEFl65EZQcZWEoqmbCFz3ZI_73eoWsCQ-843V9G-UV8qcF_BNZQHN-ZCEXRm3p2Ehi3Zu76RuG2dpJQ"}}},"title":"Remove dead foreign key optimization code · postgres/postgres@34479d9","appPayload":{"helpUrl":"https://docs.github.com","findInDiffWorkerPath":"/assets-cdn/worker/find-in-diff-worker-2bfe39677d14.js","enabled_features":{"diff_ux_refresh_beta":false,"diff_inline_comments":true,"diff_ux_refresh_ssr_five":false,"diff_ux_refresh_ssr_ten":false,"react_diff_line_type_character_correction":true}}}
The ri_KeysEqual() calls in the foreign-key trigger functions to
optimize away some updates are useless because since
adfeef5 those triggers are not enqueued
at all. (It's also not useful to keep these checks as some kind of
backstop, since it's also semantically correct to just run the full
check even with equal keys.)
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
0 commit comments