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":"e353389d24da48c708f72379f87e9b518baac521","url":"/postgres/postgres/commit/e353389d24da48c708f72379f87e9b518baac521","authoredDate":"2018-07-16T18:38:09.000-04:00","committedDate":"2018-07-16T18:38:59.000-04:00","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003eFix partition pruning with IS [NOT] NULL clauses\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"The original code was unable to prune partitions that could not possibly\ncontain NULL values, when the query specified less than all columns in a\nmulticolumn partition key. Reorder the if-tests so that it is, and add\nmore commentary and regression tests.\n\nReported-by: Ashutosh Bapat \u0026lt;ashutosh.bapat@enterprisedb.com\u0026gt;\nCo-authored-by: Dilip Kumar \u0026lt;dilipbalaut@gmail.com\u0026gt;\nCo-authored-by: Amit Langote \u0026lt;Langote_Amit_f8@lab.ntt.co.jp\u0026gt;\nCo-authored-by: Álvaro Herrera \u0026lt;alvherre@alvh.no-ip.org\u0026gt;\nReviewed-by: Ashutosh Bapat \u0026lt;ashutosh.bapat@enterprisedb.com\u0026gt;\nReviewed-by: amul sul \u0026lt;sulamul@gmail.com\u0026gt;\nDiscussion: \u003ca href=\"https://postgr.es/m/CAFjFpRc7qjLUfXLVBBC_HAnx644sjTYM=qVoT3TJ840HPbsTXw@mail.gmail.com\" rel=\"nofollow\"\u003ehttps://postgr.es/m/CAFjFpRc7qjLUfXLVBBC_HAnx644sjTYM=qVoT3TJ840HPbsTXw@mail.gmail.com\u003c/a\u003e","authors":[{"login":"alvherre","displayName":"Alvaro Herrera","avatarUrl":"https://avatars.githubusercontent.com/u/340005?v=4","path":"/alvherre","isGitHub":false},{"login":"dilipbalaut11","displayName":"Dilip Kumar","avatarUrl":"https://avatars.githubusercontent.com/u/27284397?v=4","path":"/dilipbalaut11","isGitHub":false},{"login":null,"displayName":"Amit Langote","avatarUrl":"https://github.githubassets.com/images/gravatars/gravatar-user-420.png","isGitHub":false}],"committerAttribution":false,"committer":{"login":"alvherre","displayName":"Alvaro Herrera","avatarUrl":"https://avatars.githubusercontent.com/u/340005?v=4","path":"/alvherre","isGitHub":false},"parents":["32df1c9afa5a11e37b154fe50df7a4f016f289e4"],"globalRelayId":"MDY6Q29tbWl0OTI3NDQyOmUzNTMzODlkMjRkYTQ4YzcwOGY3MjM3OWY4N2U5YjUxOGJhYWM1MjE=","sha1":"32df1c9afa5a11e37b154fe50df7a4f016f289e4","sha2":"e353389d24da48c708f72379f87e9b518baac521"},"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":852,"text":"@@ -853,54 +853,60 @@ gen_partprune_steps_internal(GeneratePruningStepsContext *context,","html":"@@ -853,54 +853,60 @@ gen_partprune_steps_internal(GeneratePruningStepsContext *context,","displayNoNewLineWarning":false,"position":0,"left":852,"right":852},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":853,"text":" \t\t}","html":" \t\t}","displayNoNewLineWarning":false,"position":1,"left":853,"right":853},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":854,"text":" \t}","html":" \t}","displayNoNewLineWarning":false,"position":2,"left":854,"right":854},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":855,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":3,"left":855,"right":855},{"stylingDirective":null,"type":"DELETION","blobLineNumber":856,"text":"-\t/*","html":"-\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":856,"right":855},{"stylingDirective":null,"type":"DELETION","blobLineNumber":857,"text":"-\t * If generate_opsteps is set to false it means no OpExprs were directly","html":"-\u003cspan class=pl-c\u003e\t * If generate_opsteps is set to false it means no OpExprs were directly\u003c/span\u003e","displayNoNewLineWarning":false,"position":5,"left":857,"right":855},{"stylingDirective":null,"type":"DELETION","blobLineNumber":858,"text":"-\t * present in the input list.","html":"-\u003cspan class=pl-c\u003e\t * present in the input list.\u003c/span\u003e","displayNoNewLineWarning":false,"position":6,"left":858,"right":855},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":856,"text":"+\t/*-----------","html":"+\t\u003cspan class=pl-c\u003e/*-----------\u003c/span\u003e","displayNoNewLineWarning":false,"position":7,"left":858,"right":856},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":857,"text":"+\t * Now generate some (more) pruning steps. We have three strategies:","html":"+\u003cspan class=pl-c\u003e\t * Now generate some (more) pruning steps. We have three strategies:\u003c/span\u003e","displayNoNewLineWarning":false,"position":8,"left":858,"right":857},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":858,"text":"+\t *","html":"+\u003cspan class=pl-c\u003e\t *\u003c/span\u003e","displayNoNewLineWarning":false,"position":9,"left":858,"right":858},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":859,"text":"+\t * 1) Generate pruning steps based on IS NULL clauses:","html":"+\u003cspan class=pl-c\u003e\t * 1) Generate pruning steps based on IS NULL clauses:\u003c/span\u003e","displayNoNewLineWarning":false,"position":10,"left":858,"right":859},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":860,"text":"+\t * a) For list partitioning, null partition keys can only be found in","html":"+\u003cspan class=pl-c\u003e\t * a) For list partitioning, null partition keys can only be found in\u003c/span\u003e","displayNoNewLineWarning":false,"position":11,"left":858,"right":860},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":861,"text":"+\t * the designated null-accepting partition, so if there are IS NULL","html":"+\u003cspan class=pl-c\u003e\t * the designated null-accepting partition, so if there are IS NULL\u003c/span\u003e","displayNoNewLineWarning":false,"position":12,"left":858,"right":861},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":862,"text":"+\t * clauses containing partition keys we should generate a pruning","html":"+\u003cspan class=pl-c\u003e\t * clauses containing partition keys we should generate a pruning\u003c/span\u003e","displayNoNewLineWarning":false,"position":13,"left":858,"right":862},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":863,"text":"+\t * step that gets rid of all partitions but that one. We can","html":"+\u003cspan class=pl-c\u003e\t * step that gets rid of all partitions but that one. We can\u003c/span\u003e","displayNoNewLineWarning":false,"position":14,"left":858,"right":863},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":864,"text":"+\t * disregard any OpExpr we may have found.","html":"+\u003cspan class=pl-c\u003e\t * disregard any OpExpr we may have found.\u003c/span\u003e","displayNoNewLineWarning":false,"position":15,"left":858,"right":864},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":865,"text":"+\t * b) For range partitioning, only the default partition can contain","html":"+\u003cspan class=pl-c\u003e\t * b) For range partitioning, only the default partition can contain\u003c/span\u003e","displayNoNewLineWarning":false,"position":16,"left":858,"right":865},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":866,"text":"+\t * NULL values, so the same rationale applies.","html":"+\u003cspan class=pl-c\u003e\t * NULL values, so the same rationale applies.\u003c/span\u003e","displayNoNewLineWarning":false,"position":17,"left":858,"right":866},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":867,"text":"+\t * c) For hash partitioning, we only apply this strategy if we have","html":"+\u003cspan class=pl-c\u003e\t * c) For hash partitioning, we only apply this strategy if we have\u003c/span\u003e","displayNoNewLineWarning":false,"position":18,"left":858,"right":867},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":868,"text":"+\t * IS NULL clauses for all the keys. Strategy 2 below will take","html":"+\u003cspan class=pl-c\u003e\t * IS NULL clauses for all the keys. Strategy 2 below will take\u003c/span\u003e","displayNoNewLineWarning":false,"position":19,"left":858,"right":868},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":869,"text":"+\t * care of the case where some keys have OpExprs and others have","html":"+\u003cspan class=pl-c\u003e\t * care of the case where some keys have OpExprs and others have\u003c/span\u003e","displayNoNewLineWarning":false,"position":20,"left":858,"right":869},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":870,"text":"+\t * IS NULL clauses.","html":"+\u003cspan class=pl-c\u003e\t * IS NULL clauses.\u003c/span\u003e","displayNoNewLineWarning":false,"position":21,"left":858,"right":870},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":871,"text":"+\t *","html":"+\u003cspan class=pl-c\u003e\t *\u003c/span\u003e","displayNoNewLineWarning":false,"position":22,"left":858,"right":871},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":872,"text":"+\t * 2) If not, generate steps based on OpExprs we have (if any).","html":"+\u003cspan class=pl-c\u003e\t * 2) If not, generate steps based on OpExprs we have (if any).\u003c/span\u003e","displayNoNewLineWarning":false,"position":23,"left":858,"right":872},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":873,"text":"+\t *","html":"+\u003cspan class=pl-c\u003e\t *\u003c/span\u003e","displayNoNewLineWarning":false,"position":24,"left":858,"right":873},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":874,"text":"+\t * 3) If this doesn't work either, we may be able to generate steps to","html":"+\u003cspan class=pl-c\u003e\t * 3) If this doesn\u0026#39;t work either, we may be able to generate steps to\u003c/span\u003e","displayNoNewLineWarning":false,"position":25,"left":858,"right":874},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":875,"text":"+\t * prune just the null-accepting partition (if one exists), if we have","html":"+\u003cspan class=pl-c\u003e\t * prune just the null-accepting partition (if one exists), if we have\u003c/span\u003e","displayNoNewLineWarning":false,"position":26,"left":858,"right":875},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":876,"text":"+\t * IS NOT NULL clauses for all partition keys.","html":"+\u003cspan class=pl-c\u003e\t * IS NOT NULL clauses for all partition keys.\u003c/span\u003e","displayNoNewLineWarning":false,"position":27,"left":858,"right":876},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":877,"text":" \t */","html":" \u003cspan class=pl-c\u003e\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":28,"left":859,"right":877},{"stylingDirective":null,"type":"DELETION","blobLineNumber":860,"text":"-\tif (!generate_opsteps)","html":"-\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (!\u003cspan class=pl-s1\u003egenerate_opsteps\u003c/span\u003e)","displayNoNewLineWarning":false,"position":29,"left":860,"right":877},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":878,"text":"+\tif (!bms_is_empty(nullkeys) \u0026\u0026","html":"+\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (!\u003cspan class=pl-en\u003ebms_is_empty\u003c/span\u003e(\u003cspan class=pl-s1\u003enullkeys\u003c/span\u003e) \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":30,"left":860,"right":878},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":879,"text":"+\t\t(part_scheme-\u003estrategy == PARTITION_STRATEGY_LIST ||","html":"+\t\t(\u003cspan class=pl-s1\u003epart_scheme\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003estrategy\u003c/span\u003e \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-c1\u003ePARTITION_STRATEGY_LIST\u003c/span\u003e \u003cspan class=pl-c1\u003e||\u003c/span\u003e","displayNoNewLineWarning":false,"position":31,"left":860,"right":879},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":880,"text":"+\t\t part_scheme-\u003estrategy == PARTITION_STRATEGY_RANGE ||","html":"+\t\t \u003cspan class=pl-s1\u003epart_scheme\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003estrategy\u003c/span\u003e \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-c1\u003ePARTITION_STRATEGY_RANGE\u003c/span\u003e \u003cspan class=pl-c1\u003e||\u003c/span\u003e","displayNoNewLineWarning":false,"position":32,"left":860,"right":880},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":881,"text":"+\t\t (part_scheme-\u003estrategy == PARTITION_STRATEGY_HASH \u0026\u0026","html":"+\t\t (\u003cspan class=pl-s1\u003epart_scheme\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003estrategy\u003c/span\u003e \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-c1\u003ePARTITION_STRATEGY_HASH\u003c/span\u003e \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":33,"left":860,"right":881},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":882,"text":"+\t\t bms_num_members(nullkeys) == part_scheme-\u003epartnatts)))","html":"+\t\t \u003cspan class=pl-en\u003ebms_num_members\u003c/span\u003e(\u003cspan class=pl-s1\u003enullkeys\u003c/span\u003e) \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-s1\u003epart_scheme\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003epartnatts\u003c/span\u003e)))","displayNoNewLineWarning":false,"position":34,"left":860,"right":882},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":883,"text":" \t{","html":" \t{","displayNoNewLineWarning":false,"position":35,"left":861,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":862,"text":"-\t\t/*","html":"-\t\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":36,"left":862,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":863,"text":"-\t\t * Generate one prune step for the information derived from IS NULL,","html":"-\u003cspan class=pl-c\u003e\t\t * Generate one prune step for the information derived from IS NULL,\u003c/span\u003e","displayNoNewLineWarning":false,"position":37,"left":863,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":864,"text":"-\t\t * if any. To prune hash partitions, we must have found IS NULL","html":"-\u003cspan class=pl-c\u003e\t\t * if any. To prune hash partitions, we must have found IS NULL\u003c/span\u003e","displayNoNewLineWarning":false,"position":38,"left":864,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":865,"text":"-\t\t * clauses for all partition keys.","html":"-\u003cspan class=pl-c\u003e\t\t * clauses for all partition keys.\u003c/span\u003e","displayNoNewLineWarning":false,"position":39,"left":865,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":866,"text":"-\t\t */","html":"-\u003cspan class=pl-c\u003e\t\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":40,"left":866,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":867,"text":"-\t\tif (!bms_is_empty(nullkeys) \u0026\u0026","html":"-\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (!\u003cspan class=pl-en\u003ebms_is_empty\u003c/span\u003e(\u003cspan class=pl-s1\u003enullkeys\u003c/span\u003e) \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":41,"left":867,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":868,"text":"-\t\t\t(part_scheme-\u003estrategy != PARTITION_STRATEGY_HASH ||","html":"-\t\t\t(\u003cspan class=pl-s1\u003epart_scheme\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003estrategy\u003c/span\u003e \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003ePARTITION_STRATEGY_HASH\u003c/span\u003e \u003cspan class=pl-c1\u003e||\u003c/span\u003e","displayNoNewLineWarning":false,"position":42,"left":868,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":869,"text":"-\t\t\t bms_num_members(nullkeys) == part_scheme-\u003epartnatts))","html":"-\t\t\t \u003cspan class=pl-en\u003ebms_num_members\u003c/span\u003e(\u003cspan class=pl-s1\u003enullkeys\u003c/span\u003e) \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-s1\u003epart_scheme\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003epartnatts\u003c/span\u003e))","displayNoNewLineWarning":false,"position":43,"left":869,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":870,"text":"-\t\t{","html":"-\t\t{","displayNoNewLineWarning":false,"position":44,"left":870,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":871,"text":"-\t\t\tPartitionPruneStep *step;","html":"-\t\t\t\u003cspan class=pl-smi\u003ePartitionPruneStep\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003estep\u003c/span\u003e;","displayNoNewLineWarning":false,"position":45,"left":871,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":872,"text":"-","html":"-","displayNoNewLineWarning":false,"position":46,"left":872,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":873,"text":"-\t\t\tstep = gen_prune_step_op(context, InvalidStrategy,","html":"-\t\t\t\u003cspan class=pl-s1\u003estep\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-en\u003egen_prune_step_op\u003c/span\u003e(\u003cspan class=pl-s1\u003econtext\u003c/span\u003e, \u003cspan class=pl-s1\u003eInvalidStrategy\u003c/span\u003e,","displayNoNewLineWarning":false,"position":47,"left":873,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":874,"text":"-\t\t\t\t\t\t\t\t\t false, NIL, NIL, nullkeys);","html":"-\t\t\t\t\t\t\t\t\t false, \u003cspan class=pl-c1\u003eNIL\u003c/span\u003e, \u003cspan class=pl-c1\u003eNIL\u003c/span\u003e, \u003cspan class=pl-s1\u003enullkeys\u003c/span\u003e);","displayNoNewLineWarning":false,"position":48,"left":874,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":875,"text":"-\t\t\tresult = lappend(result, step);","html":"-\t\t\t\u003cspan class=pl-s1\u003eresult\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-en\u003elappend\u003c/span\u003e(\u003cspan class=pl-s1\u003eresult\u003c/span\u003e, \u003cspan class=pl-s1\u003estep\u003c/span\u003e);","displayNoNewLineWarning":false,"position":49,"left":875,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":876,"text":"-\t\t}","html":"-\t\t}","displayNoNewLineWarning":false,"position":50,"left":876,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":877,"text":"-","html":"-","displayNoNewLineWarning":false,"position":51,"left":877,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":878,"text":"-\t\t/*","html":"-\t\t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":52,"left":878,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":879,"text":"-\t\t * Note that for IS NOT NULL clauses, simply having step suffices;","html":"-\u003cspan class=pl-c\u003e\t\t * Note that for IS NOT NULL clauses, simply having step suffices;\u003c/span\u003e","displayNoNewLineWarning":false,"position":53,"left":879,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":880,"text":"-\t\t * there is no need to propagate the exact details of which keys are","html":"-\u003cspan class=pl-c\u003e\t\t * there is no need to propagate the exact details of which keys are\u003c/span\u003e","displayNoNewLineWarning":false,"position":54,"left":880,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":881,"text":"-\t\t * required to be NOT NULL. Hash partitioning expects to see actual","html":"-\u003cspan class=pl-c\u003e\t\t * required to be NOT NULL. Hash partitioning expects to see actual\u003c/span\u003e","displayNoNewLineWarning":false,"position":55,"left":881,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":882,"text":"-\t\t * values to perform any pruning.","html":"-\u003cspan class=pl-c\u003e\t\t * values to perform any pruning.\u003c/span\u003e","displayNoNewLineWarning":false,"position":56,"left":882,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":883,"text":"-\t\t */","html":"-\u003cspan class=pl-c\u003e\t\t */\u003c/span\u003e","displayNoNewLineWarning":false,"position":57,"left":883,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":884,"text":"-\t\tif (!bms_is_empty(notnullkeys) \u0026\u0026","html":"-\t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (!\u003cspan class=pl-en\u003ebms_is_empty\u003c/span\u003e(\u003cspan class=pl-s1\u003enotnullkeys\u003c/span\u003e) \u003cspan class=pl-c1\u003e\u0026amp;\u0026amp;\u003c/span\u003e","displayNoNewLineWarning":false,"position":58,"left":884,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":885,"text":"-\t\t\tpart_scheme-\u003estrategy != PARTITION_STRATEGY_HASH)","html":"-\t\t\t\u003cspan class=pl-s1\u003epart_scheme\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003estrategy\u003c/span\u003e \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003ePARTITION_STRATEGY_HASH\u003c/span\u003e)","displayNoNewLineWarning":false,"position":59,"left":885,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":886,"text":"-\t\t{","html":"-\t\t{","displayNoNewLineWarning":false,"position":60,"left":886,"right":883},{"stylingDirective":null,"type":"DELETION","blobLineNumber":887,"text":"-\t\t\tPartitionPruneStep *step;","html":"-\t\t\t\u003cspan class=pl-smi\u003ePartitionPruneStep\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003estep\u003c/span\u003e;","displayNoNewLineWarning":false,"position":61,"left":887,"right":883},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":884,"text":"+\t\tPartitionPruneStep *step;","html":"+\t\t\u003cspan class=pl-smi\u003ePartitionPruneStep\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003estep\u003c/span\u003e;","displayNoNewLineWarning":false,"position":62,"left":887,"right":884},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":885,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":63,"left":888,"right":885},{"stylingDirective":null,"type":"DELETION","blobLineNumber":889,"text":"-\t\t\tstep = gen_prune_step_op(context, InvalidStrategy,","html":"-\t\t\u003cspan class=\"x x-first\"\u003e\t\u003c/span\u003e\u003cspan class=\"pl-s1 x\"\u003estep\u003c/span\u003e\u003cspan class=\"x\"\u003e \u003c/span\u003e\u003cspan class=\"pl-c1 x\"\u003e=\u003c/span\u003e\u003cspan class=\"x\"\u003e \u003c/span\u003e\u003cspan class=\"pl-en x\"\u003egen_prune_step_op\u003c/span\u003e\u003cspan class=\"x\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1 x\"\u003econtext\u003c/span\u003e\u003cspan class=\"x\"\u003e, \u003c/span\u003e\u003cspan class=\"pl-s1 x\"\u003eInvalidStrategy\u003c/span\u003e\u003cspan class=\"x x-last\"\u003e,\u003c/span\u003e","displayNoNewLineWarning":false,"position":64,"left":889,"right":885},{"stylingDirective":null,"type":"DELETION","blobLineNumber":890,"text":"-\t\t\t\t\t\t\t\t\t false, NIL, NIL, NULL);","html":"-\t\t\u003cspan class=\"x x-first\"\u003e\t\t\t\t\t\t\t false, \u003c/span\u003e\u003cspan class=\"pl-c1 x\"\u003eNIL\u003c/span\u003e\u003cspan class=\"x\"\u003e, \u003c/span\u003e\u003cspan class=\"pl-c1 x\"\u003eNIL\u003c/span\u003e\u003cspan class=\"x\"\u003e, \u003c/span\u003e\u003cspan class=\"pl-c1 x\"\u003eNULL\u003c/span\u003e\u003cspan class=\"x x-last\"\u003e);\u003c/span\u003e","displayNoNewLineWarning":false,"position":65,"left":890,"right":885},{"stylingDirective":null,"type":"DELETION","blobLineNumber":891,"text":"-\t\t\tresult = lappend(result, step);","html":"-\t\t\t\u003cspan class=\"pl-s1 x x-first\"\u003eresult\u003c/span\u003e\u003cspan class=\"x\"\u003e \u003c/span\u003e\u003cspan class=\"pl-c1 x\"\u003e=\u003c/span\u003e\u003cspan class=\"x\"\u003e \u003c/span\u003e\u003cspan class=\"pl-en x\"\u003elappend\u003c/span\u003e\u003cspan class=\"x\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1 x\"\u003eresult\u003c/span\u003e\u003cspan class=\"x\"\u003e, \u003c/span\u003e\u003cspan class=\"pl-s1 x x-last\"\u003estep\u003c/span\u003e);","displayNoNewLineWarning":false,"position":66,"left":891,"right":885},{"stylingDirective":null,"type":"DELETION","blobLineNumber":892,"text":"-\t\t}","html":"-\t\t\u003cspan class=\"x x-first x-last\"\u003e}\u003c/span\u003e","displayNoNewLineWarning":false,"position":67,"left":892,"right":885},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":886,"text":"+\t\t/* Strategy 1 */","html":"+\t\t\u003cspan class=\"pl-c x x-first x-last\"\u003e/* Strategy 1 */\u003c/span\u003e","displayNoNewLineWarning":false,"position":68,"left":892,"right":886},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":887,"text":"+\t\tstep = gen_prune_step_op(context, InvalidStrategy,","html":"+\t\t\u003cspan class=\"pl-s1 x x-first\"\u003estep\u003c/span\u003e\u003cspan class=\"x\"\u003e \u003c/span\u003e\u003cspan class=\"pl-c1 x\"\u003e=\u003c/span\u003e\u003cspan class=\"x\"\u003e \u003c/span\u003e\u003cspan class=\"pl-en x\"\u003egen_prune_step_op\u003c/span\u003e\u003cspan class=\"x\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1 x\"\u003econtext\u003c/span\u003e\u003cspan class=\"x\"\u003e, \u003c/span\u003e\u003cspan class=\"pl-s1 x\"\u003eInvalidStrategy\u003c/span\u003e\u003cspan class=\"x x-last\"\u003e,\u003c/span\u003e","displayNoNewLineWarning":false,"position":69,"left":892,"right":887},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":888,"text":"+\t\t\t\t\t\t\t\t false, NIL, NIL, nullkeys);","html":"+\t\t\t\u003cspan class=\"x x-first\"\u003e\t\t\t\t\t false, \u003c/span\u003e\u003cspan class=\"pl-c1 x\"\u003eNIL\u003c/span\u003e\u003cspan class=\"x\"\u003e, \u003c/span\u003e\u003cspan class=\"pl-c1 x\"\u003eNIL\u003c/span\u003e\u003cspan class=\"x\"\u003e, \u003c/span\u003e\u003cspan class=\"pl-s1 x x-last\"\u003enullkeys\u003c/span\u003e);","displayNoNewLineWarning":false,"position":70,"left":892,"right":888},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":889,"text":"+\t\tresult = lappend(result, step);","html":"+\t\t\u003cspan class=\"pl-s1 x x-first\"\u003eresult\u003c/span\u003e\u003cspan class=\"x\"\u003e \u003c/span\u003e\u003cspan class=\"pl-c1 x\"\u003e=\u003c/span\u003e\u003cspan class=\"x\"\u003e \u003c/span\u003e\u003cspan class=\"pl-en x\"\u003elappend\u003c/span\u003e\u003cspan class=\"x\"\u003e(\u003c/span\u003e\u003cspan class=\"pl-s1 x\"\u003eresult\u003c/span\u003e\u003cspan class=\"x\"\u003e, \u003c/span\u003e\u003cspan class=\"pl-s1 x\"\u003estep\u003c/span\u003e\u003cspan class=\"x x-last\"\u003e);\u003c/span\u003e","displayNoNewLineWarning":false,"position":71,"left":892,"right":889},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":890,"text":" \t}","html":" \t}","displayNoNewLineWarning":false,"position":72,"left":893,"right":890},{"stylingDirective":null,"type":"DELETION","blobLineNumber":894,"text":"-\telse","html":"-\t\u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e","displayNoNewLineWarning":false,"position":73,"left":894,"right":890},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":891,"text":"+\telse if (generate_opsteps)","html":"+\t\u003cspan class=\"pl-k\"\u003eelse\u003c/span\u003e\u003cspan class=\"x x-first\"\u003e \u003c/span\u003e\u003cspan class=\"pl-k x\"\u003eif\u003c/span\u003e\u003cspan class=\"x\"\u003e (\u003c/span\u003e\u003cspan class=\"pl-s1 x\"\u003egenerate_opsteps\u003c/span\u003e\u003cspan class=\"x x-last\"\u003e)\u003c/span\u003e","displayNoNewLineWarning":false,"position":74,"left":894,"right":891},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":892,"text":" \t{","html":" \t{","displayNoNewLineWarning":false,"position":75,"left":895,"right":892},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":893,"text":" \t\tPartitionPruneStep *step;","html":" \t\t\u003cspan class=pl-smi\u003ePartitionPruneStep\u003c/span\u003e \u003cspan class=pl-c1\u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003estep\u003c/span\u003e;","displayNoNewLineWarning":false,"position":76,"left":896,"right":893},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":894,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":77,"left":897,"right":894},{"stylingDirective":null,"type":"DELETION","blobLineNumber":898,"text":"-\t\t/* Generate pruning steps from OpExpr clauses in keyclauses. */","html":"-\t\t\u003cspan class=\"pl-c\"\u003e/* \u003cspan class=\"x x-first x-last\"\u003eGenerate pruning steps from OpExpr clauses in keyclauses.\u003c/span\u003e */\u003c/span\u003e","displayNoNewLineWarning":false,"position":78,"left":898,"right":894},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":895,"text":"+\t\t/* Strategy 2 */","html":"+\t\t\u003cspan class=\"pl-c\"\u003e/* \u003cspan class=\"x x-first x-last\"\u003eStrategy 2\u003c/span\u003e */\u003c/span\u003e","displayNoNewLineWarning":false,"position":79,"left":898,"right":895},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":896,"text":" \t\tstep = gen_prune_steps_from_opexps(part_scheme, context,","html":" \t\t\u003cspan class=pl-s1\u003estep\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-en\u003egen_prune_steps_from_opexps\u003c/span\u003e(\u003cspan class=pl-s1\u003epart_scheme\u003c/span\u003e, \u003cspan class=pl-s1\u003econtext\u003c/span\u003e,","displayNoNewLineWarning":false,"position":80,"left":899,"right":896},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":897,"text":" \t\t\t\t\t\t\t\t\t\t keyclauses, nullkeys);","html":" \t\t\t\t\t\t\t\t\t\t \u003cspan class=pl-s1\u003ekeyclauses\u003c/span\u003e, \u003cspan class=pl-s1\u003enullkeys\u003c/span\u003e);","displayNoNewLineWarning":false,"position":81,"left":900,"right":897},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":898,"text":" \t\tif (step != NULL)","html":" \t\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-s1\u003estep\u003c/span\u003e \u003cspan class=pl-c1\u003e!=\u003c/span\u003e \u003cspan class=pl-c1\u003eNULL\u003c/span\u003e)","displayNoNewLineWarning":false,"position":82,"left":901,"right":898},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":899,"text":" \t\t\tresult = lappend(result, step);","html":" \t\t\t\u003cspan class=pl-s1\u003eresult\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-en\u003elappend\u003c/span\u003e(\u003cspan class=pl-s1\u003eresult\u003c/span\u003e, \u003cspan class=pl-s1\u003estep\u003c/span\u003e);","displayNoNewLineWarning":false,"position":83,"left":902,"right":899},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":900,"text":" \t}","html":" \t}","displayNoNewLineWarning":false,"position":84,"left":903,"right":900},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":901,"text":"+\telse if (bms_num_members(notnullkeys) == part_scheme-\u003epartnatts)","html":"+\t\u003cspan class=pl-k\u003eelse\u003c/span\u003e \u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-en\u003ebms_num_members\u003c/span\u003e(\u003cspan class=pl-s1\u003enotnullkeys\u003c/span\u003e) \u003cspan class=pl-c1\u003e==\u003c/span\u003e \u003cspan class=pl-s1\u003epart_scheme\u003c/span\u003e\u003cspan class=pl-c1\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=pl-c1\u003epartnatts\u003c/span\u003e)","displayNoNewLineWarning":false,"position":85,"left":903,"right":901},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":902,"text":"+\t{","html":"+\t{","displayNoNewLineWarning":false,"position":86,"left":903,"right":902},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":903,"text":"+\t\tPartitionPruneStep *step;","html":"+\t\t\u003cspan class=pl-smi\u003ePartitionPruneStep\u003c/span\u003e \u003cspan class=pl-c1\
8000
u003e*\u003c/span\u003e\u003cspan class=pl-s1\u003estep\u003c/span\u003e;","displayNoNewLineWarning":false,"position":87,"left":903,"right":903},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":904,"text":"+","html":"+","displayNoNewLineWarning":false,"position":88,"left":903,"right":904},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":905,"text":"+\t\t/* Strategy 3 */","html":"+\t\t\u003cspan class=pl-c\u003e/* Strategy 3 */\u003c/span\u003e","displayNoNewLineWarning":false,"position":89,"left":903,"right":905},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":906,"text":"+\t\tstep = gen_prune_step_op(context, InvalidStrategy,","html":"+\t\t\u003cspan class=pl-s1\u003estep\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-en\u003egen_prune_step_op\u003c/span\u003e(\u003cspan class=pl-s1\u003econtext\u003c/span\u003e, \u003cspan class=pl-s1\u003eInvalidStrategy\u003c/span\u003e,","displayNoNewLineWarning":false,"position":90,"left":903,"right":906},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":907,"text":"+\t\t\t\t\t\t\t\t false, NIL, NIL, NULL);","html":"+\t\t\t\t\t\t\t\t false, \u003cspan class=pl-c1\u003eNIL\u003c/span\u003e, \u003cspan class=pl-c1\u003eNIL\u003c/span\u003e, \u003cspan class=pl-c1\u003eNULL\u003c/span\u003e);","displayNoNewLineWarning":false,"position":91,"left":903,"right":907},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":908,"text":"+\t\tresult = lappend(result, step);","html":"+\t\t\u003cspan class=pl-s1\u003eresult\u003c/span\u003e \u003cspan class=pl-c1\u003e=\u003c/span\u003e \u003cspan class=pl-en\u003elappend\u003c/span\u003e(\u003cspan class=pl-s1\u003eresult\u003c/span\u003e, \u003cspan class=pl-s1\u003estep\u003c/span\u003e);","displayNoNewLineWarning":false,"position":92,"left":903,"right":908},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":909,"text":"+\t}","html":"+\t}","displayNoNewLineWarning":false,"position":93,"left":903,"right":909},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":910,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":94,"left":904,"right":910},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":911,"text":" \t/*","html":" \t\u003cspan class=pl-c\u003e/*\u003c/span\u003e","displayNoNewLineWarning":false,"position":95,"left":905,"right":911},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":912,"text":" \t * Finally, results from all entries appearing in result should be","html":" \u003cspan class=pl-c\u003e\t * Finally, results from all entries appearing in result should be\u003c/span\u003e","displayNoNewLineWarning":false,"position":96,"left":906,"right":912}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":3192,"linesChanged":78,"newTreeEntry":{"lineCount":3192,"path":"src/backend/partitioning/partprune.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/backend/partitioning/partprune.c","mode":100644},"linesAdded":42,"linesDeleted":36,"path":"src/backend/partitioning/partprune.c","pathDigest":"4cea0c7ceb47e61b974a7524e5a0840ebe7f4b31cc6a4fdb32447c8d42d13c17","status":"MODIFIED","truncatedReason":null,"oldOid":"32df1c9afa5a11e37b154fe50df7a4f016f289e4","newOid":"e353389d24da48c708f72379f87e9b518baac521","copilotChatReference":null,"deletedSha":"32df1c9afa5a11e37b154fe50df7a4f016f289e4","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":992,"text":"@@ -993,6 +993,47 @@ explain (costs off) select * from mc2p where a = 1 and b \u003e 1;","html":"@@ -993,6 +993,47 @@ explain (costs off) select * from mc2p where a = 1 and b \u0026gt; 1;","displayNoNewLineWarning":false,"position":0,"left":992,"right":992},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":993,"text":" Filter: ((b \u003e 1) AND (a = 1))","html":" Filter: ((b \u0026gt; 1) AND (a = 1))","displayNoNewLineWarning":false,"position":1,"left":993,"right":993},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":994,"text":" (3 rows)","html":" (3 rows)","displayNoNewLineWarning":false,"position":2,"left":994,"right":994},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":995,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":3,"left":995,"right":995},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":996,"text":"+-- all partitions but the default one should be pruned","html":"+-- all partitions but the default one should be pruned","displayNoNewLineWarning":false,"position":4,"left":995,"right":996},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":997,"text":"+explain (costs off) select * from mc2p where a = 1 and b is null;","html":"+explain (costs off) select * from mc2p where a = 1 and b is null;","displayNoNewLineWarning":false,"position":5,"left":995,"right":997},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":998,"text":"+ QUERY PLAN ","html":"+ QUERY PLAN ","displayNoNewLineWarning":false,"position":6,"left":995,"right":998},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":999,"text":"+-------------------------------------------","html":"+-------------------------------------------","displayNoNewLineWarning":false,"position":7,"left":995,"right":999},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1000,"text":"+ Append","html":"+ Append","displayNoNewLineWarning":false,"position":8,"left":995,"right":1000},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1001,"text":"+ -\u003e Seq Scan on mc2p_default","html":"+ -\u0026gt; Seq Scan on mc2p_default","displayNoNewLineWarning":false,"position":9,"left":995,"right":1001},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1002,"text":"+ Filter: ((b IS NULL) AND (a = 1))","html":"+ Filter: ((b IS NULL) AND (a = 1))","displayNoNewLineWarning":false,"position":10,"left":995,"right":1002},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1003,"text":"+(3 rows)","html":"+(3 rows)","displayNoNewLineWarning":false,"position":11,"left":995,"right":1003},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1004,"text":"+","html":"+","displayNoNewLineWarning":false,"position":12,"left":995,"right":1004},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1005,"text":"+explain (costs off) select * from mc2p where a is null and b is null;","html":"+explain (costs off) select * from mc2p where a is null and b is null;","displayNoNewLineWarning":false,"position":13,"left":995,"right":1005},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1006,"text":"+ QUERY PLAN ","html":"+ QUERY PLAN ","displayNoNewLineWarning":false,"position":14,"left":995,"right":1006},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1007,"text":"+-----------------------------------------------","html":"+-----------------------------------------------","displayNoNewLineWarning":false,"position":15,"left":995,"right":1007},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1008,"text":"+ Append","html":"+ Append","displayNoNewLineWarning":false,"position":16,"left":995,"right":1008},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1009,"text":"+ -\u003e Seq Scan on mc2p_default","html":"+ -\u0026gt; Seq Scan on mc2p_default","displayNoNewLineWarning":false,"position":17,"left":995,"right":1009},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1010,"text":"+ Filter: ((a IS NULL) AND (b IS NULL))","html":"+ Filter: ((a IS NULL) AND (b IS NULL))","displayNoNewLineWarning":false,"position":18,"left":995,"right":1010},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1011,"text":"+(3 rows)","html":"+(3 rows)","displayNoNewLineWarning":false,"position":19,"left":995,"right":1011},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1012,"text":"+","html":"+","displayNoNewLineWarning":false,"position":20,"left":995,"right":1012},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1013,"text":"+explain (costs off) select * from mc2p where a is null and b = 1;","html":"+explain (costs off) select * from mc2p where a is null and b = 1;","displayNoNewLineWarning":false,"position":21,"left":995,"right":1013},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1014,"text":"+ QUERY PLAN ","html":"+ QUERY PLAN ","displayNoNewLineWarning":false,"position":22,"left":995,"right":1014},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1015,"text":"+-------------------------------------------","html":"+-------------------------------------------","displayNoNewLineWarning":false,"position":23,"left":995,"right":1015},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1016,"text":"+ Append","html":"+ Append","displayNoNewLineWarning":false,"position":24,"left":995,"right":1016},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1017,"text":"+ -\u003e Seq Scan on mc2p_default","html":"+ -\u0026gt; Seq Scan on mc2p_default","displayNoNewLineWarning":false,"position":25,"left":995,"right":1017},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1018,"text":"+ Filter: ((a IS NULL) AND (b = 1))","html":"+ Filter: ((a IS NULL) AND (b = 1))","displayNoNewLineWarning":false,"position":26,"left":995,"right":1018},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1019,"text":"+(3 rows)","html":"+(3 rows)","displayNoNewLineWarning":false,"position":27,"left":995,"right":1019},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1020,"text":"+","html":"+","displayNoNewLineWarning":false,"position":28,"left":995,"right":1020},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1021,"text":"+explain (costs off) select * from mc2p where a is null;","html":"+explain (costs off) select * from mc2p where a is null;","displayNoNewLineWarning":false,"position":29,"left":995,"right":1021},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1022,"text":"+ QUERY PLAN ","html":"+ QUERY PLAN ","displayNoNewLineWarning":false,"position":30,"left":995,"right":1022},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1023,"text":"+--------------------------------","html":"+--------------------------------","displayNoNewLineWarning":false,"position":31,"left":995,"right":1023},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1024,"text":"+ Append","html":"+ Append","displayNoNewLineWarning":false,"position":32,"left":995,"right":1024},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1025,"text":"+ -\u003e Seq Scan on mc2p_default","html":"+ -\u0026gt; Seq Scan on mc2p_default","displayNoNewLineWarning":false,"position":33,"left":995,"right":1025},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1026,"text":"+ Filter: (a IS NULL)","html":"+ Filter: (a IS NULL)","displayNoNewLineWarning":false,"position":34,"left":995,"right":1026},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1027,"text":"+(3 rows)","html":"+(3 rows)","displayNoNewLineWarning":false,"position":35,"left":995,"right":1027},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1028,"text":"+","html":"+","displayNoNewLineWarning":false,"position":36,"left":995,"right":1028},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1029,"text":"+explain (costs off) select * from mc2p where b is null;","html":"+explain (costs off) select * from mc2p where b is null;","displayNoNewLineWarning":false,"position":37,"left":995,"right":1029},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1030,"text":"+ QUERY PLAN ","html":"+ QUERY PLAN ","displayNoNewLineWarning":false,"position":38,"left":995,"right":1030},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1031,"text":"+--------------------------------","html":"+--------------------------------","displayNoNewLineWarning":false,"position":39,"left":995,"right":1031},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1032,"text":"+ Append","html":"+ Append","displayNoNewLineWarning":false,"position":40,"left":995,"right":1032},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1033,"text":"+ -\u003e Seq Scan on mc2p_default","html":"+ -\u0026gt; Seq Scan on mc2p_default","displayNoNewLineWarning":false,"position":41,"left":995,"right":1033},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1034,"text":"+ Filter: (b IS NULL)","html":"+ Filter: (b IS NULL)","displayNoNewLineWarning":false,"position":42,"left":995,"right":1034},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1035,"text":"+(3 rows)","html":"+(3 rows)","displayNoNewLineWarning":false,"position":43,"left":995,"right":1035},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1036,"text":"+","html":"+","displayNoNewLineWarning":false,"position":44,"left":995,"right":1036},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1037,"text":" -- boolean partitioning","html":" -- boolean partitioning","displayNoNewLineWarning":false,"position":45,"left":996,"right":1037},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1038,"text":" create table boolpart (a bool) partition by list (a);","html":" create table boolpart (a bool) partition by list (a);","displayNoNewLineWarning":false,"position":46,"left":997,"right":1038},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1039,"text":" create table boolpart_default partition of boolpart default;","html":" create table boolpart_default partition of boolpart default;","displayNoNewLineWarning":false,"position":47,"left":998,"right":1039}],"diffNumber":1,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":3168,"linesChanged":41,"newTreeEntry":{"lineCount":3168,"path":"src/test/regress/expected/partition_prune.out","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/test/regress/expected/partition_prune.out","mode":100644},"linesAdded":41,"linesDeleted":0,"path":"src/test/regress/expected/partition_prune.out","pathDigest":"789eb4147ba182a57d9c57686f8fc0ebdcdd84efe45899549286db43369f1901","status":"MODIFIED","truncatedReason":null,"oldOid":"32df1c9afa5a11e37b154fe50df7a4f016f289e4","newOid":"e353389d24da48c708f72379f87e9b518baac521","copilotChatReference":null,"deletedSha":"32df1c9afa5a11e37b154fe50df7a4f016f289e4","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":136,"text":"@@ -137,6 +137,13 @@ explain (costs off) select * from mc2p where a = 2 and b \u003c 1;","html":"@@ -137,6 +137,13 @@ explain (costs off) select * from mc2p where a = 2 and b \u0026lt; 1;","displayNoNewLineWarning":false,"position":0,"left":136,"right":136},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":137,"text":" explain (costs off) select * from mc2p where a \u003e 1;","html":" explain (costs off) \u003cspan class=\"pl-k\"\u003eselect\u003c/span\u003e \u003cspan class=\"pl-k\"\u003e*\u003c/span\u003e \u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e mc2p \u003cspan class=\"pl-k\"\u003ewhere\u003c/span\u003e a \u003cspan class=\"pl-k\"\u003e\u0026gt;\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e;","displayNoNewLineWarning":false,"position":1,"left":137,"right":137},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":138,"text":" explain (costs off) select * from mc2p where a = 1 and b \u003e 1;","html":" explain (costs off) \u003cspan class=\"pl-k\"\u003eselect\u003c/span\u003e \u003cspan class=\"pl-k\"\u003e*\u003c/span\u003e \u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e mc2p \u003cspan class=\"pl-k\"\u003ewhere\u003c/span\u003e a \u003cspan class=\"pl-k\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eand\u003c/span\u003e b \u003cspan class=\"pl-k\"\u003e\u0026gt;\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e;","displayNoNewLineWarning":false,"position":2,"left":138,"right":138},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":139,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":3,"left":139,"right":139},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":140,"text":"+-- all partitions but the default one should be pruned","html":"+\u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e all partitions but the default one should be pruned\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":139,"right":140},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":141,"text":"+explain (costs off) select * from mc2p where a = 1 and b is null;","html":"+explain (costs off) \u003cspan class=\"pl-k\"\u003eselect\u003c/span\u003e \u003cspan class=\"pl-k\"\u003e*\u003c/span\u003e \u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e mc2p \u003cspan class=\"pl-k\"\u003ewhere\u003c/span\u003e a \u003cspan class=\"pl-k\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eand\u003c/span\u003e b is \u003cspan class=\"pl-k\"\u003enull\u003c/span\u003e;","displayNoNewLineWarning":false,"position":5,"left":139,"right":141},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":142,"text":"+explain (costs off) select * from mc2p where a is null and b is null;","html":"+explain (costs off) \u003cspan class=\"pl-k\"\u003eselect\u003c/span\u003e \u003cspan class=\"pl-k\"\u003e*\u003c/span\u003e \u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e mc2p \u003cspan class=\"pl-k\"\u003ewhere\u003c/span\u003e a is \u003cspan class=\"pl-k\"\u003enull\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eand\u003c/span\u003e b is \u003cspan class=\"pl-k\"\u003enull\u003c/span\u003e;","displayNoNewLineWarning":false,"position":6,"left":139,"right":142},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":143,"text":"+explain (costs off) select * from mc2p where a is null and b = 1;","html":"+explain (costs off) \u003cspan class=\"pl-k\"\u003eselect\u003c/span\u003e \u003cspan class=\"pl-k\"\u003e*\u003c/span\u003e \u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e mc2p \u003cspan class=\"pl-k\"\u003ewhere\u003c/span\u003e a is \u003cspan class=\"pl-k\"\u003enull\u003c/span\u003e \u003cspan class=\"pl-k\"\u003eand\u003c/span\u003e b \u003cspan class=\"pl-k\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e1\u003c/span\u003e;","displayNoNewLineWarning":false,"position":7,"left":139,"right":143},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":144,"text":"+explain (costs off) select * from mc2p where a is null;","html":"+explain (costs off) \u003cspan class=\"pl-k\"\u003eselect\u003c/span\u003e \u003cspan class=\"pl-k\"\u003e*\u003c/span\u003e \u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e mc2p \u003cspan class=\"pl-k\"\u003ewhere\u003c/span\u003e a is \u003cspan class=\"pl-k\"\u003enull\u003c/span\u003e;","displayNoNewLineWarning":false,"position":8,"left":139,"right":144},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":145,"text":"+explain (costs off) select * from mc2p where b is null;","html":"+explain (costs off) \u003cspan class=\"pl-k\"\u003eselect\u003c/span\u003e \u003cspan class=\"pl-k\"\u003e*\u003c/span\u003e \u003cspan class=\"pl-k\"\u003efrom\u003c/span\u003e mc2p \u003cspan class=\"pl-k\"\u003ewhere\u003c/span\u003e b is \u003cspan class=\"pl-k\"\u003enull\u003c/span\u003e;","displayNoNewLineWarning":false,"position":9,"left":139,"right":145},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":146,"text":"+","html":"+","displayNoNewLineWarning":false,"position":10,"left":139,"right":146},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":147,"text":" -- boolean partitioning","html":" \u003cspan class=\"pl-c\"\u003e\u003cspan class=\"pl-c\"\u003e--\u003c/span\u003e boolean partitioning\u003c/span\u003e","displayNoNewLineWarning":false,"position":11,"left":140,"right":147},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":148,"text":" create table boolpart (a bool) partition by list (a);","html":" \u003cspan class=\"pl-k\"\u003ecreate\u003c/span\u003e \u003cspan class=\"pl-k\"\u003etable\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eboolpart\u003c/span\u003e (a bool) partition by list (a);","displayNoNewLineWarning":false,"position":12,"left":141,"right":148},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":149,"text":" create table boolpart_default partition of boolpart default;","html":" \u003cspan class=\"pl-k\"\u003ecreate\u003c/span\u003e \u003cspan class=\"pl-k\"\u003etable\u003c/span\u003e \u003cspan class=\"pl-en\"\u003eboolpart_default\u003c/span\u003e partition of boolpart default;","displayNoNewLineWarning":false,"position":13,"left":142,"right":149}],"diffNumber":2,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":832,"linesChanged":7,"newTreeEntry":{"lineCount":832,"path":"src/test/regress/sql/partition_prune.sql","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/test/regress/sql/partition_prune.sql","mode":100644},"linesAdded":7,"linesDeleted":0,"path":"src/test/regress/sql/partition_prune.sql","pathDigest":"62108ec673984d80d4a9f6312ef83bbaa386e2b6950395f3a0745d0b3026c2ef","status":"MODIFIED","truncatedReason":null,"oldOid":"32df1c9afa5a11e37b154fe50df7a4f016f289e4","newOid":"e353389d24da48c708f72379f87e9b518baac521","copilotChatReference":null,"deletedSha":"32df1c9afa5a11e37b154fe50df7a4f016f289e4","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/e353389d24da48c708f72379f87e9b518baac521","fileTreeExpanded":true,"headerInfo":{"additions":90,"deletions":36,"filesChanged":3,"filesChangedString":"3"},"moreDiffsToLoad":false,"asyncDiffLoadInfo":{"startIndex":3,"truncated":false,"byteCount":5756,"lineShownCount":159},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"lYMZi8Fxp54BUKI6Hd9HLKvccv-nDYmPzmZy-jRypnph4b1U5C_jNFqmfFPYluY8uyAwVxGyOiEhQFinNK1euA"},"/users/diffview?diff=unified":{"post":"3BP1U26Y7FQqZoZUMDyg0ivuCRaicYv4A0NGY_4DwvIocVGMS8ao_nGQWD31dQHCOxJLvhTOOFbsZWw-_tw6MA"},"/notifications/thread":{"post":"Qicpv-1s3bIj_UfLQ_TP02JgX6CLH7viEGyiqV4-JnA-3S37IOZdLTVbfeB6LcWf2JRrOjLKCYUHojZxPhyvng"}}},"title":"Fix partition pruning with IS [NOT] NULL clauses · postgres/postgres@e353389","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 original code was unable to prune partitions that could not possibly
contain NULL values, when the query specified less than all columns in a
multicolumn partition key. Reorder the if-tests so that it is, and add
more commentary and regression tests.
Reported-by: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Co-authored-by: Dilip Kumar <dilipbalaut@gmail.com>
Co-authored-by: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Reviewed-by: amul sul <sulamul@gmail.com>
Discussion: https://postgr.es/m/CAFjFpRc7qjLUfXLVBBC_HAnx644sjTYM=qVoT3TJ840HPbsTXw@mail.gmail.com
0 commit comments