Richard Guo <guofengli...@gmail.com> writes: > Or maybe we can make it even earlier, when we expand an RTE for a > partitioned table and add result tables to leaf_result_relids.
I'm not really on board with injecting command-type-specific logic into completely unrelated places just so that we can throw an error a bit earlier. Alvaro's suggestion of make_modifytable seemed plausible, not least because it avoids spending any effort when the command couldn't be MERGE at all. regards, tom lane