Fix compilation warning in copy code

This change fixes a compilation warning in the
copy code that was introduced with an earlier
refactoring PR.
This commit is contained in:
Erik Nordström 2017-11-15 10:50:29 +01:00 committed by Erik Nordström
parent e6936cbfa5
commit 0497744803
2 changed files with 8 additions and 9 deletions

View File

@ -458,6 +458,11 @@ timescaledb_DoCopy(const CopyStmt *stmt, const char *queryString, uint64 *proces
Relation rel; Relation rel;
Oid relid; Oid relid;
List *range_table = NIL; List *range_table = NIL;
TupleDesc tupDesc;
AclMode required_access = (is_from ? ACL_INSERT : ACL_SELECT);
List *attnums;
ListCell *cur;
RangeTblEntry *rte;
/* Disallow COPY to/from file or program except to superusers. */ /* Disallow COPY to/from file or program except to superusers. */
if (!pipe && !superuser()) if (!pipe && !superuser())
@ -477,15 +482,7 @@ timescaledb_DoCopy(const CopyStmt *stmt, const char *queryString, uint64 *proces
} }
if (!is_from || NULL == stmt->relation) if (!is_from || NULL == stmt->relation)
{
elog(ERROR, "timescale DoCopy should only be called for COPY FROM"); elog(ERROR, "timescale DoCopy should only be called for COPY FROM");
}
TupleDesc tupDesc;
AclMode required_access = (is_from ? ACL_INSERT : ACL_SELECT);
List *attnums;
ListCell *cur;
RangeTblEntry *rte;
Assert(!stmt->query); Assert(!stmt->query);
@ -504,6 +501,7 @@ timescaledb_DoCopy(const CopyStmt *stmt, const char *queryString, uint64 *proces
tupDesc = RelationGetDescr(rel); tupDesc = RelationGetDescr(rel);
attnums = timescaledb_CopyGetAttnums(tupDesc, rel, stmt->attlist); attnums = timescaledb_CopyGetAttnums(tupDesc, rel, stmt->attlist);
foreach(cur, attnums) foreach(cur, attnums)
{ {
int attno = lfirst_int(cur) - int attno = lfirst_int(cur) -
@ -514,6 +512,7 @@ timescaledb_DoCopy(const CopyStmt *stmt, const char *queryString, uint64 *proces
else else
rte->selectedCols = bms_add_member(rte->selectedCols, attno); rte->selectedCols = bms_add_member(rte->selectedCols, attno);
} }
ExecCheckRTPerms(range_table, true); ExecCheckRTPerms(range_table, true);
/* /*

View File

@ -208,7 +208,7 @@ calculate_closed_range_default(Dimension *dim, int64 value)
range_end; range_end;
/* The interval that divides the dimension into N equal sized slices */ /* The interval that divides the dimension into N equal sized slices */
int64 interval = DIMENSION_SLICE_CLOSED_MAX / ((int64)dim->fd.num_slices); int64 interval = DIMENSION_SLICE_CLOSED_MAX / ((int64) dim->fd.num_slices);
int64 last_start = interval * (dim->fd.num_slices - 1); int64 last_start = interval * (dim->fd.num_slices - 1);
if (value < 0) if (value < 0)