mirror of https://github.com/citusdata/citus.git
Fix issue with GROUP BY + DEFAULT
parent
150205223c
commit
f849487cb3
|
@ -48,6 +48,7 @@
|
||||||
#include "utils/builtins.h"
|
#include "utils/builtins.h"
|
||||||
#include "utils/lsyscache.h"
|
#include "utils/lsyscache.h"
|
||||||
#include "utils/rel.h"
|
#include "utils/rel.h"
|
||||||
|
#include <nodes/print.h>
|
||||||
|
|
||||||
|
|
||||||
static void PrepareInsertSelectForCitusPlanner(Query *insertSelectQuery);
|
static void PrepareInsertSelectForCitusPlanner(Query *insertSelectQuery);
|
||||||
|
@ -958,6 +959,7 @@ ReorderInsertSelectTargetLists(Query *originalQuery, RangeTblEntry *insertRte,
|
||||||
ListCell *insertTargetEntryCell;
|
ListCell *insertTargetEntryCell;
|
||||||
List *newSubqueryTargetlist = NIL;
|
List *newSubqueryTargetlist = NIL;
|
||||||
List *newInsertTargetlist = NIL;
|
List *newInsertTargetlist = NIL;
|
||||||
|
List *columnNameList = NIL;
|
||||||
int resno = 1;
|
int resno = 1;
|
||||||
Index selectTableId = 2;
|
Index selectTableId = 2;
|
||||||
int targetEntryIndex = 0;
|
int targetEntryIndex = 0;
|
||||||
|
@ -1029,6 +1031,9 @@ ReorderInsertSelectTargetLists(Query *originalQuery, RangeTblEntry *insertRte,
|
||||||
newSubqueryTargetEntry);
|
newSubqueryTargetEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String *columnName = makeString(newSubqueryTargetEntry->resname);
|
||||||
|
columnNameList = lappend(columnNameList, columnName);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The newly created select target entry cannot be a junk entry since junk
|
* The newly created select target entry cannot be a junk entry since junk
|
||||||
* entries are not in the final target list and we're processing the
|
* entries are not in the final target list and we're processing the
|
||||||
|
@ -1080,6 +1085,7 @@ ReorderInsertSelectTargetLists(Query *originalQuery, RangeTblEntry *insertRte,
|
||||||
|
|
||||||
originalQuery->targetList = newInsertTargetlist;
|
originalQuery->targetList = newInsertTargetlist;
|
||||||
subquery->targetList = newSubqueryTargetlist;
|
subquery->targetList = newSubqueryTargetlist;
|
||||||
|
subqueryRte->eref->colnames = columnNameList;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue