Fix segmentation fault and add some spaces
This commit is contained in:
parent
01bc0111f7
commit
60e6a358b5
2 changed files with 16 additions and 9 deletions
|
|
@ -262,7 +262,11 @@ ExecCreateImmv(ParseState *pstate, CreateTableAsStmt *stmt,
|
||||||
/* Create an index on incremental maintainable materialized view, if possible */
|
/* Create an index on incremental maintainable materialized view, if possible */
|
||||||
CreateIndexOnIMMV(viewQuery, matviewRel, true);
|
CreateIndexOnIMMV(viewQuery, matviewRel, true);
|
||||||
|
|
||||||
/* Create triggers on incremental maintainable materialized view */
|
/*
|
||||||
|
* Create triggers on incremental maintainable materialized view
|
||||||
|
* This argument should use 'query'. This needs to use a rewritten query,
|
||||||
|
* because a sublink in jointree is not supported by this function.
|
||||||
|
*/
|
||||||
CreateIvmTriggersOnBaseTables(query, matviewOid, true);
|
CreateIvmTriggersOnBaseTables(query, matviewOid, true);
|
||||||
|
|
||||||
/* Create triggers to prevent IMMV from beeing changed */
|
/* Create triggers to prevent IMMV from beeing changed */
|
||||||
|
|
|
||||||
19
matview.c
19
matview.c
|
|
@ -1049,10 +1049,10 @@ IVM_immediate_maintenance(PG_FUNCTION_ARGS)
|
||||||
char *count_colname = NULL;
|
char *count_colname = NULL;
|
||||||
|
|
||||||
/* check if the modified table is in EXISTS clause. */
|
/* check if the modified table is in EXISTS clause. */
|
||||||
for (i = 0; i< list_length(rte_path); i++)
|
for (i = 0; i < list_length(rte_path); i++)
|
||||||
{
|
{
|
||||||
int index = lfirst_int(list_nth_cell(rte_path, i));
|
int index = lfirst_int(list_nth_cell(rte_path, i));
|
||||||
rte = (RangeTblEntry *)lfirst(list_nth_cell(querytree->rtable, index - 1));
|
rte = (RangeTblEntry *) lfirst(list_nth_cell(querytree->rtable, index - 1));
|
||||||
|
|
||||||
if (rte != NULL && rte->rtekind == RTE_SUBQUERY)
|
if (rte != NULL && rte->rtekind == RTE_SUBQUERY)
|
||||||
{
|
{
|
||||||
|
|
@ -1540,7 +1540,7 @@ rewrite_query_for_distinct_and_aggregates(Query *query, ParseState *pstate)
|
||||||
/* Add count(*) used for EXISTS clause */
|
/* Add count(*) used for EXISTS clause */
|
||||||
foreach(tbl_lc, query->rtable)
|
foreach(tbl_lc, query->rtable)
|
||||||
{
|
{
|
||||||
RangeTblEntry *rte = (RangeTblEntry *)lfirst(tbl_lc);
|
RangeTblEntry *rte = (RangeTblEntry *) lfirst(tbl_lc);
|
||||||
varno++;
|
varno++;
|
||||||
if (rte->subquery)
|
if (rte->subquery)
|
||||||
{
|
{
|
||||||
|
|
@ -1600,11 +1600,14 @@ rewrite_exists_subquery_walker(Query *query, Node *node, int *count)
|
||||||
FromExpr *fromexpr;
|
FromExpr *fromexpr;
|
||||||
|
|
||||||
/* get subquery in WHERE clause */
|
/* get subquery in WHERE clause */
|
||||||
fromexpr = (FromExpr *)query->jointree;
|
fromexpr = (FromExpr *) query->jointree;
|
||||||
query = rewrite_exists_subquery_walker(query, fromexpr->quals, count);
|
if (fromexpr->quals != NULL)
|
||||||
/* drop subquery in WHERE clause */
|
{
|
||||||
if (IsA(fromexpr->quals, SubLink))
|
query = rewrite_exists_subquery_walker(query, fromexpr->quals, count);
|
||||||
fromexpr->quals = NULL;
|
/* drop subquery in WHERE clause */
|
||||||
|
if (IsA(fromexpr->quals, SubLink))
|
||||||
|
fromexpr->quals = NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case T_BoolExpr:
|
case T_BoolExpr:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue