mirror of https://github.com/citusdata/citus.git
Rename functions in insert_select_planner for consistency and clarity
parent
30eb4a1cbe
commit
1ee6927168
|
@ -97,14 +97,14 @@ static List * AddInsertSelectCasts(List *insertTargetList, List *selectTargetLis
|
||||||
static Expr * CastExpr(Expr *expr, Oid sourceType, Oid targetType, Oid targetCollation,
|
static Expr * CastExpr(Expr *expr, Oid sourceType, Oid targetType, Oid targetCollation,
|
||||||
int targetTypeMod);
|
int targetTypeMod);
|
||||||
static Oid GetNextvalReturnTypeCatalog(void);
|
static Oid GetNextvalReturnTypeCatalog(void);
|
||||||
static void append_casted_entry(TargetEntry *insertEntry, TargetEntry *selectEntry,
|
static void AppendCastedEntry(TargetEntry *insertEntry, TargetEntry *selectEntry,
|
||||||
Oid castFromType, Oid targetType, Oid collation, int32
|
Oid castFromType, Oid targetType, Oid collation, int32
|
||||||
typmod,
|
typmod,
|
||||||
int targetEntryIndex,
|
int targetEntryIndex,
|
||||||
List **projectedEntries, List **nonProjectedEntries);
|
List **projectedEntries, List **nonProjectedEntries);
|
||||||
static void set_target_entry_name(TargetEntry *tle, const char *format, int index);
|
static void SetTargetEntryName(TargetEntry *tle, const char *format, int index);
|
||||||
static void reset_target_entry_resno(List *targetList);
|
static void ResetTargetEntryResno(List *targetList);
|
||||||
static void process_entry_pair(TargetEntry *insertEntry, TargetEntry *selectEntry,
|
static void ProcessEntryPair(TargetEntry *insertEntry, TargetEntry *selectEntry,
|
||||||
Form_pg_attribute attr, int targetEntryIndex,
|
Form_pg_attribute attr, int targetEntryIndex,
|
||||||
List **projectedEntries, List **nonProjectedEntries);
|
List **projectedEntries, List **nonProjectedEntries);
|
||||||
|
|
||||||
|
@ -1664,7 +1664,7 @@ AddInsertSelectCasts(List *insertTargetList, List *selectTargetList,
|
||||||
Form_pg_attribute attr = TupleDescAttr(destTupleDescriptor,
|
Form_pg_attribute attr = TupleDescAttr(destTupleDescriptor,
|
||||||
insertEntry->resno - 1);
|
insertEntry->resno - 1);
|
||||||
|
|
||||||
process_entry_pair(insertEntry, selectEntry, attr, targetEntryIndex,
|
ProcessEntryPair(insertEntry, selectEntry, attr, targetEntryIndex,
|
||||||
&projectedEntries, &nonProjectedEntries);
|
&projectedEntries, &nonProjectedEntries);
|
||||||
|
|
||||||
targetEntryIndex++;
|
targetEntryIndex++;
|
||||||
|
@ -1681,7 +1681,7 @@ AddInsertSelectCasts(List *insertTargetList, List *selectTargetList,
|
||||||
|
|
||||||
/* Concatenate projected and non-projected entries and reset resno numbering */
|
/* Concatenate projected and non-projected entries and reset resno numbering */
|
||||||
selectTargetList = list_concat(projectedEntries, nonProjectedEntries);
|
selectTargetList = list_concat(projectedEntries, nonProjectedEntries);
|
||||||
reset_target_entry_resno(selectTargetList);
|
ResetTargetEntryResno(selectTargetList);
|
||||||
|
|
||||||
table_close(distributedRelation, NoLock);
|
table_close(distributedRelation, NoLock);
|
||||||
|
|
||||||
|
@ -1695,7 +1695,7 @@ AddInsertSelectCasts(List *insertTargetList, List *selectTargetList,
|
||||||
* original select entry or a casted version to the appropriate list.
|
* original select entry or a casted version to the appropriate list.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
process_entry_pair(TargetEntry *insertEntry, TargetEntry *selectEntry,
|
ProcessEntryPair(TargetEntry *insertEntry, TargetEntry *selectEntry,
|
||||||
Form_pg_attribute attr, int targetEntryIndex,
|
Form_pg_attribute attr, int targetEntryIndex,
|
||||||
List **projectedEntries, List **nonProjectedEntries)
|
List **projectedEntries, List **nonProjectedEntries)
|
||||||
{
|
{
|
||||||
|
@ -1723,7 +1723,7 @@ process_entry_pair(TargetEntry *insertEntry, TargetEntry *selectEntry,
|
||||||
|
|
||||||
if (effectiveSourceType != targetType)
|
if (effectiveSourceType != targetType)
|
||||||
{
|
{
|
||||||
append_casted_entry(insertEntry, selectEntry,
|
AppendCastedEntry(insertEntry, selectEntry,
|
||||||
effectiveSourceType, targetType,
|
effectiveSourceType, targetType,
|
||||||
attr->attcollation, attr->atttypmod,
|
attr->attcollation, attr->atttypmod,
|
||||||
targetEntryIndex,
|
targetEntryIndex,
|
||||||
|
@ -1742,7 +1742,7 @@ process_entry_pair(TargetEntry *insertEntry, TargetEntry *selectEntry,
|
||||||
* they are numbered sequentially.
|
* they are numbered sequentially.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
reset_target_entry_resno(List *targetList)
|
ResetTargetEntryResno(List *targetList)
|
||||||
{
|
{
|
||||||
int entryResNo = 1;
|
int entryResNo = 1;
|
||||||
ListCell *lc = NULL;
|
ListCell *lc = NULL;
|
||||||
|
@ -1791,7 +1791,7 @@ GetNextvalReturnTypeCatalog(void)
|
||||||
* it is marked as junk to avoid ambiguity.
|
* it is marked as junk to avoid ambiguity.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
append_casted_entry(TargetEntry *insertEntry, TargetEntry *selectEntry,
|
AppendCastedEntry(TargetEntry *insertEntry, TargetEntry *selectEntry,
|
||||||
Oid castFromType, Oid targetType, Oid collation, int32 typmod,
|
Oid castFromType, Oid targetType, Oid collation, int32 typmod,
|
||||||
int targetEntryIndex,
|
int targetEntryIndex,
|
||||||
List **projectedEntries, List **nonProjectedEntries)
|
List **projectedEntries, List **nonProjectedEntries)
|
||||||
|
@ -1815,7 +1815,7 @@ append_casted_entry(TargetEntry *insertEntry, TargetEntry *selectEntry,
|
||||||
coercedEntry->ressortgroupref = 0;
|
coercedEntry->ressortgroupref = 0;
|
||||||
|
|
||||||
/* Assign a unique name to the coerced entry */
|
/* Assign a unique name to the coerced entry */
|
||||||
set_target_entry_name(coercedEntry, "auto_coerced_by_citus_%d", targetEntryIndex);
|
SetTargetEntryName(coercedEntry, "auto_coerced_by_citus_%d", targetEntryIndex);
|
||||||
*projectedEntries = lappend(*projectedEntries, coercedEntry);
|
*projectedEntries = lappend(*projectedEntries, coercedEntry);
|
||||||
|
|
||||||
/* If the original select entry is referenced in ORDER BY or GROUP BY,
|
/* If the original select entry is referenced in ORDER BY or GROUP BY,
|
||||||
|
@ -1824,7 +1824,7 @@ append_casted_entry(TargetEntry *insertEntry, TargetEntry *selectEntry,
|
||||||
if (selectEntry->ressortgroupref != 0)
|
if (selectEntry->ressortgroupref != 0)
|
||||||
{
|
{
|
||||||
selectEntry->resjunk = true;
|
selectEntry->resjunk = true;
|
||||||
set_target_entry_name(selectEntry, "discarded_target_item_%d", targetEntryIndex);
|
SetTargetEntryName(selectEntry, "discarded_target_item_%d", targetEntryIndex);
|
||||||
*nonProjectedEntries = lappend(*nonProjectedEntries, selectEntry);
|
*nonProjectedEntries = lappend(*nonProjectedEntries, selectEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1913,7 +1913,7 @@ CastExpr(Expr *expr, Oid sourceType, Oid targetType, Oid targetCollation,
|
||||||
|
|
||||||
/* Helper function to set the target entry name using a formatted string */
|
/* Helper function to set the target entry name using a formatted string */
|
||||||
static void
|
static void
|
||||||
set_target_entry_name(TargetEntry *tle, const char *format, int index)
|
SetTargetEntryName(TargetEntry *tle, const char *format, int index)
|
||||||
{
|
{
|
||||||
StringInfo resnameString = makeStringInfo();
|
StringInfo resnameString = makeStringInfo();
|
||||||
appendStringInfo(resnameString, format, index);
|
appendStringInfo(resnameString, format, index);
|
||||||
|
|
Loading…
Reference in New Issue