Fix bogus range_table_mutator() logic for RangeTblEntry.tablesample.

Must make a copy of the TableSampleClause node; the previous coding
modified the input data structure in-place.

Petr Jelinek
This commit is contained in:
Tom Lane 2015-06-19 11:41:45 -04:00
parent ed16f73c57
commit be87143fe9

View File

@ -2870,10 +2870,14 @@ range_table_mutator(List *rtable,
case RTE_RELATION:
if (rte->tablesample)
{
MUTATE(rte->tablesample->args, rte->tablesample->args,
CHECKFLATCOPY(newrte->tablesample, rte->tablesample,
TableSampleClause);
MUTATE(newrte->tablesample->args,
newrte->tablesample->args,
List *);
MUTATE(rte->tablesample->repeatable,
rte->tablesample->repeatable, Node *);
MUTATE(newrte->tablesample->repeatable,
newrte->tablesample->repeatable,
Node *);
}
break;
case RTE_CTE: