|
9 | 9 | * list and row ID information needed for SELECT FOR UPDATE locking and/or
|
10 | 10 | * EvalPlanQual checking.
|
11 | 11 | *
|
12 |
| - * NOTE: the rewriter's rewriteTargetListIU and rewriteTargetListUD |
13 |
| - * routines also do preprocessing of the targetlist. The division of labor |
14 |
| - * between here and there is a bit arbitrary and historical. |
| 12 | + * The rewriter's rewriteTargetListIU and rewriteTargetListUD routines |
| 13 | + * also do preprocessing of the targetlist. The division of labor between |
| 14 | + * here and there is partially historical, but it's not entirely arbitrary. |
| 15 | + * In particular, consider an UPDATE across an inheritance tree. What the |
| 16 | + * rewriter does need be done only once (because it depends only on the |
| 17 | + * properties of the parent relation). What's done here has to be done over |
| 18 | + * again for each child relation, because it depends on the column list of |
| 19 | + * the child, which might have more columns and/or a different column order |
| 20 | + * than the parent. |
| 21 | + * |
| 22 | + * The fact that rewriteTargetListIU sorts non-resjunk tlist entries by column |
| 23 | + * position, which expand_targetlist depends on, violates the above comment |
| 24 | + * because the sorting is only valid for the parent relation. In inherited |
| 25 | + * UPDATE cases, adjust_inherited_tlist runs in between to take care of fixing |
| 26 | + * the tlists for child tables to keep expand_targetlist happy. We do it like |
| 27 | + * that because it's faster in typical non-inherited cases. |
15 | 28 | *
|
16 | 29 | *
|
17 | 30 | * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
|
|