Fix style

pull/5209/head
Sait Talha Nisanci 2021-08-25 17:17:16 +03:00
parent e1f5520e1a
commit 0b67fcf81d
34 changed files with 90 additions and 79 deletions

View File

@ -2019,7 +2019,6 @@ ColumnarProcessUtility(PlannedStmt *pstmt,
DestReceiver *dest,
QueryCompletionCompat *completionTag)
{
#if PG_VERSION_NUM >= PG_VERSION_14
if (readOnlyTree)
{

View File

@ -251,7 +251,9 @@ GetDependencyCreateDDLCommands(const ObjectAddress *dependency)
*/
Assert(false);
ereport(ERROR, (errmsg("unsupported object %s for distribution by citus",
getObjectTypeDescription_compat(dependency, /* missingOk: */ false)),
getObjectTypeDescription_compat(dependency,
/* missingOk: */ false)),
errdetail(
"citus tries to recreate an unsupported object on its workers"),
errhint("please report a bug as this should not be happening")));

View File

@ -212,9 +212,9 @@ DoLocalCopy(StringInfo buffer, Oid relationId, int64 shardId, CopyStmt *copyStat
(void) addRangeTableEntryForRelation(pState, shard, AccessShareLock,
NULL, false, false);
CopyFromState cstate = BeginCopyFrom_compat(pState, shard, NULL, NULL, false,
ReadFromLocalBufferCallback,
copyStatement->attlist,
copyStatement->options);
ReadFromLocalBufferCallback,
copyStatement->attlist,
copyStatement->options);
CopyFrom(cstate);
EndCopyFrom(cstate);

View File

@ -525,13 +525,13 @@ CopyToExistingShards(CopyStmt *copyStatement, QueryCompletionCompat *completionT
/* initialize copy state to read from COPY data source */
CopyFromState copyState = BeginCopyFrom_compat(NULL,
copiedDistributedRelation,
NULL,
copyStatement->filename,
copyStatement->is_program,
NULL,
copyStatement->attlist,
copyStatement->options);
copiedDistributedRelation,
NULL,
copyStatement->filename,
copyStatement->is_program,
NULL,
copyStatement->attlist,
copyStatement->options);
/* set up callback to identify error line number */
errorCallback.callback = CopyFromErrorCallback;
@ -627,13 +627,13 @@ CopyToNewShards(CopyStmt *copyStatement, QueryCompletionCompat *completionTag, O
/* initialize copy state to read from COPY data source */
CopyFromState copyState = BeginCopyFrom_compat(NULL,
distributedRelation,
NULL,
copyStatement->filename,
copyStatement->is_program,
NULL,
copyStatement->attlist,
copyStatement->options);
distributedRelation,
NULL,
copyStatement->filename,
copyStatement->is_program,
NULL,
copyStatement->attlist,
copyStatement->options);
CopyOutState copyOutState = (CopyOutState) palloc0(sizeof(CopyOutStateData));
copyOutState->delim = (char *) delimiterCharacter;

View File

@ -2448,16 +2448,16 @@ ErrorIfUnsupportedAlterTableStmt(AlterTableStmt *alterTableStatement)
#if PG_VERSION_NUM >= PG_VERSION_14
case AT_SetCompression:
#endif
{
/*
* We will not perform any special check for:
* ALTER TABLE .. ALTER COLUMN .. SET NOT NULL
* ALTER TABLE .. REPLICA IDENTITY ..
* ALTER TABLE .. VALIDATE CONSTRAINT ..
* ALTER TABLE .. ALTER COLUMN .. SET COMPRESSION ..
*/
break;
}
{
/*
* We will not perform any special check for:
* ALTER TABLE .. ALTER COLUMN .. SET NOT NULL
* ALTER TABLE .. REPLICA IDENTITY ..
* ALTER TABLE .. VALIDATE CONSTRAINT ..
* ALTER TABLE .. ALTER COLUMN .. SET COMPRESSION ..
*/
break;
}
case AT_SetRelOptions: /* SET (...) */
case AT_ResetRelOptions: /* RESET (...) */

View File

@ -810,15 +810,21 @@ deparse_shard_reindex_statement(ReindexStmt *origStmt, Oid distrelid, int64 shar
}
}
/*
* IsReindexWithParam_compat returns true if the given parameter
* exists for the given reindexStmt.
*/
bool IsReindexWithParam_compat(ReindexStmt* reindexStmt, char* param) {
bool
IsReindexWithParam_compat(ReindexStmt *reindexStmt, char *param)
{
#if PG_VERSION_NUM < PG_VERSION_14
if (strcmp(param, "concurrently") == 0) {
if (strcmp(param, "concurrently") == 0)
{
return reindexStmt->concurrent;
}else if (strcmp(param, "verbose") == 0) {
}
else if (strcmp(param, "verbose") == 0)
{
return reindexStmt->options & REINDEXOPT_VERBOSE;
}
return false;
@ -833,7 +839,6 @@ bool IsReindexWithParam_compat(ReindexStmt* reindexStmt, char* param) {
}
return false;
#endif
}
@ -1292,6 +1297,7 @@ RoleSpecString(RoleSpec *spec, bool withQuoteIdentifier)
quote_identifier(spec->rolename) :
spec->rolename;
}
#if PG_VERSION_NUM >= PG_VERSION_14
case ROLESPEC_CURRENT_ROLE:
#endif

View File

@ -233,6 +233,7 @@ AppendStatTypes(StringInfo buf, CreateStatsStmt *stmt)
appendStringInfoString(buf, ")");
}
#if PG_VERSION_NUM >= PG_VERSION_14
static void
AppendColumnNames(StringInfo buf, CreateStatsStmt *stmt)
@ -259,6 +260,8 @@ AppendColumnNames(StringInfo buf, CreateStatsStmt *stmt)
}
}
}
#else
static void
AppendColumnNames(StringInfo buf, CreateStatsStmt *stmt)
@ -285,6 +288,8 @@ AppendColumnNames(StringInfo buf, CreateStatsStmt *stmt)
}
}
}
#endif
static void

View File

@ -411,8 +411,8 @@ ReadFileIntoTupleStore(char *fileName, char *copyFormat, TupleDesc tupleDescript
copyOptions = lappend(copyOptions, copyOption);
CopyFromState copyState = BeginCopyFrom_compat(NULL, stubRelation, NULL,
fileName, false, NULL,
NULL, copyOptions);
fileName, false, NULL,
NULL, copyOptions);
while (true)
{

View File

@ -75,8 +75,12 @@ citus_unmark_object_distributed(PG_FUNCTION_ARGS)
{
ereport(ERROR, (errmsg("object still exists"),
errdetail("the %s \"%s\" still exists",
getObjectTypeDescription_compat(&address, /* missingOk: */ false),
getObjectIdentity_compat(&address, /* missingOk: */ false)),
getObjectTypeDescription_compat(&address,
/* missingOk: */ false),
getObjectIdentity_compat(&address,
/* missingOk: */ false)),
errhint("drop the object via a DROP command")));
}

View File

@ -689,7 +689,6 @@ ShardsMatchingDeleteCriteria(Oid relationId, List *shardIntervalList,
List *deleteCriteriaList = list_make1(deleteCriteria);
/* walk over shard list and check if shards can be dropped */
ShardInterval *shardInterval = NULL;
foreach_ptr(shardInterval, shardIntervalList)

View File

@ -286,9 +286,10 @@ ExplainSubPlans(DistributedPlan *distributedPlan, ExplainState *es)
PlannedStmt *plan = subPlan->plan;
IntoClause *into = NULL;
ParamListInfo params = NULL;
/*
* With PG14, we need to provide a string here,
* for now we put an empty string, which is valid according to postgres.
* for now we put an empty string, which is valid according to postgres.
*/
char *queryString = pstrdup("");
instr_time planduration;

View File

@ -1890,6 +1890,7 @@ MasterAggregateExpression(Aggref *originalAggregate,
if (aggregateType == AGGREGATE_ARRAY_AGG)
{
#if PG_VERSION_NUM >= PG_VERSION_14
/*
* Postgres expects the type of the array here such as INT4ARRAYOID.
* Hence we set it to workerReturnType. If we set this to

View File

@ -2054,7 +2054,8 @@ GetRestrictInfoListForRelation(RangeTblEntry *rangeTblEntry,
* If the restriction involves multiple tables, we cannot add it to
* input relation's expression list.
*/
Relids varnos = pull_varnos_compat(relationRestriction->plannerInfo, (Node *) restrictionClause);
Relids varnos = pull_varnos_compat(relationRestriction->plannerInfo,
(Node *) restrictionClause);
if (bms_num_members(varnos) != 1)
{
continue;

View File

@ -239,6 +239,7 @@ s/ERROR: ROLLBACK is not allowed in an SQL function/ERROR: ROLLBACK is not all
/.*Async Capable.*/d
/Parent Relationship/d
/Parent-Relationship/d
s/function array_cat_agg\(anyarray\) anyarray/function array_cat_agg\(anycompatiblearray\) anycompatiblearray/g
s/function array_cat_agg\(anycompatiblearray\)/function array_cat_agg\(anyarray\)/g
s/TRIM\(BOTH FROM value\)/btrim\(value\)/g
s/pg14\.idx.*/pg14\.xxxxx/g

View File

@ -20,4 +20,5 @@
/multi_mx_copy_data.out
/multi_outer_join.out
/multi_outer_join_reference.out
/tablespace.out
/worker_copy.out

View File

@ -139,7 +139,7 @@ SELECT * FROM multi_extension.print_extension_changes();
| function alter_role_if_exists(text,text) boolean
| function any_value(anyelement) anyelement
| function any_value_agg(anyelement,anyelement) anyelement
| function array_cat_agg(anycompatiblearray) anycompatiblearray
| function array_cat_agg(anyarray) anycompatiblearray
| function assign_distributed_transaction_id(integer,bigint,timestamp with time zone) void
| function authinfo_valid(text) boolean
| function broadcast_intermediate_result(text,text) bigint

View File

@ -1,5 +0,0 @@
CREATE TABLESPACE test_tablespace LOCATION '/home/talha/citus/src/test/regress/data/ts0';
\c - - - :worker_1_port
CREATE TABLESPACE test_tablespace LOCATION '/home/talha/citus/src/test/regress/data/ts1';
\c - - - :worker_2_port
CREATE TABLESPACE test_tablespace LOCATION '/home/talha/citus/src/test/regress/data/ts2';

View File

@ -26,7 +26,7 @@ ORDER BY 1;
function alter_table_set_access_method(regclass,text)
function any_value(anyelement)
function any_value_agg(anyelement,anyelement)
function array_cat_agg(anycompatiblearray)
function array_cat_agg(anyarray)
function assign_distributed_transaction_id(integer,bigint,timestamp with time zone)
function authinfo_valid(text)
function broadcast_intermediate_result(text,text)

View File

@ -23,7 +23,7 @@ ORDER BY 1;
function alter_table_set_access_method(regclass,text)
function any_value(anyelement)
function any_value_agg(anyelement,anyelement)
function array_cat_agg(anycompatiblearray)
function array_cat_agg(anyarray)
function assign_distributed_transaction_id(integer,bigint,timestamp with time zone)
function authinfo_valid(text)
function broadcast_intermediate_result(text,text)

View File

@ -20,4 +20,5 @@
/multi_mx_copy_data.sql
/multi_outer_join.sql
/multi_outer_join_reference.sql
/tablespace.sql
/worker_copy.sql

View File

@ -1,5 +0,0 @@
CREATE TABLESPACE test_tablespace LOCATION '/home/talha/citus/src/test/regress/data/ts0';
\c - - - :worker_1_port
CREATE TABLESPACE test_tablespace LOCATION '/home/talha/citus/src/test/regress/data/ts1';
\c - - - :worker_2_port
CREATE TABLESPACE test_tablespace LOCATION '/home/talha/citus/src/test/regress/data/ts2';