mirror of https://github.com/citusdata/citus.git
Remove PostgreSQL 9.4 support
parent
34d3df5a7b
commit
c20080992d
|
@ -9,7 +9,6 @@ env:
|
|||
secure: degV+qb2xHiea7E2dGk/WLvmYjq4ZsBn6ZPko+YhRcNm2GRXRaU3FqMBIecPtsEEFYaL5GwCQq/CgBf9aQxgDQ+t2CrmtGTtI9AGAbVBl//amNeJOoLe6QvrDpSQX5pUxwDLCng8cvoQK7ZxGlNCzDKiu4Ep4DUWgQVpauJkQ9nHjtSMZvUqCoI9h1lBy9Mxh7YFfHPW2PAXCqpV4VlNiIYF84UKdX3MXKLy9Yt0JBSNTWLZFp/fFw2qNwzFvN94rF3ZvFSD7Wp6CIhT6R5/6k6Zx8YQIrjWhgm6OVy1osUA8X7W79h2ISPqKqMNVJkjJ+N8S4xuQU0kfejnQ74Ie/uJiHCmbW5W2TjpL1aU3FQpPsGwR8h0rSeHhJAJzd8Ma+z8vvnnQHDyvetPBB0WgA/VMQCu8uEutyfYw2hDmB2+l2dDwkViaI7R95bReAGrpd5uNqklAXuR7yOeArz0ZZpHV0aZHGcNBxznMaZExSVZ5DVPW38UPn7Kgse8BnOWeLgnA1hJVp6CmBCtu+hKYt+atBPgRbM8IUINnKKZf/Sk6HeJIJZs662jD8/X93vFi0ZtyV2jEKJpouWw8j4vrGGsaDzTEUcyJgDqZj7tPJptM2L5B3BcFJmkGj2HO3N+LGDarJrVBBSiEjhTgx4NnLiKZnUbMx547mCRg2akk2w=
|
||||
matrix:
|
||||
- PGVERSION=9.5
|
||||
- PGVERSION=9.4
|
||||
before_install:
|
||||
- git clone --depth 1 https://github.com/citusdata/tools.git
|
||||
- tools/travis/setup_apt.sh
|
||||
|
|
|
@ -1915,7 +1915,7 @@ if test -z "$version_num"; then
|
|||
as_fn_error $? "Could not detect PostgreSQL version from pg_config." "$LINENO" 5
|
||||
fi
|
||||
|
||||
if test "$version_num" != '9.4' -a "$version_num" != '9.5'; then
|
||||
if test "$version_num" != '9.5'; then
|
||||
as_fn_error $? "Citus is not compatible with the detected PostgreSQL version ${version_num}." "$LINENO" 5
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: building against PostgreSQL $version_num" >&5
|
||||
|
|
|
@ -36,7 +36,7 @@ if test -z "$version_num"; then
|
|||
AC_MSG_ERROR([Could not detect PostgreSQL version from pg_config.])
|
||||
fi
|
||||
|
||||
if test "$version_num" != '9.4' -a "$version_num" != '9.5'; then
|
||||
if test "$version_num" != '9.5'; then
|
||||
AC_MSG_ERROR([Citus is not compatible with the detected PostgreSQL version ${version_num}.])
|
||||
else
|
||||
AC_MSG_NOTICE([building against PostgreSQL $version_num])
|
||||
|
|
|
@ -167,12 +167,6 @@ RouterExecutorStart(QueryDesc *queryDesc, int eflags, Task *task)
|
|||
*/
|
||||
queryDesc->planstate = (PlanState *) makeNode(MaterialState);
|
||||
|
||||
#if (PG_VERSION_NUM < 90500)
|
||||
|
||||
/* make sure that upsertQuery is false for versions that UPSERT is not available */
|
||||
Assert(task->upsertQuery == false);
|
||||
#endif
|
||||
|
||||
lockMode = CommutativityRuleToLockMode(commandType, task->upsertQuery);
|
||||
|
||||
if (lockMode != NoLock)
|
||||
|
@ -322,14 +316,7 @@ CreateXactParticipantHash(void)
|
|||
info.keysize = sizeof(NodeConnectionKey);
|
||||
info.entrysize = sizeof(NodeConnectionEntry);
|
||||
info.hcxt = TopTransactionContext;
|
||||
hashFlags = (HASH_ELEM | HASH_CONTEXT);
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
hashFlags |= HASH_BLOBS;
|
||||
#else
|
||||
hashFlags |= HASH_FUNCTION;
|
||||
info.hash = tag_hash;
|
||||
#endif
|
||||
hashFlags = (HASH_ELEM | HASH_CONTEXT | HASH_BLOBS);
|
||||
|
||||
xactParticipantHash = hash_create("citus xact participant hash", 32, &info,
|
||||
hashFlags);
|
||||
|
@ -1190,17 +1177,13 @@ RouterTransactionCallback(XactEvent event, void *arg)
|
|||
|
||||
switch (event)
|
||||
{
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
case XACT_EVENT_PARALLEL_COMMIT:
|
||||
#endif
|
||||
case XACT_EVENT_COMMIT:
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
case XACT_EVENT_PARALLEL_ABORT:
|
||||
#endif
|
||||
case XACT_EVENT_ABORT:
|
||||
{
|
||||
bool commit = false;
|
||||
|
@ -1221,9 +1204,7 @@ RouterTransactionCallback(XactEvent event, void *arg)
|
|||
break;
|
||||
}
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
case XACT_EVENT_PARALLEL_PRE_COMMIT:
|
||||
#endif
|
||||
case XACT_EVENT_PRE_COMMIT:
|
||||
{
|
||||
bool commit = true;
|
||||
|
|
|
@ -1036,19 +1036,10 @@ IsAlterTableRenameStmt(RenameStmt *renameStmt)
|
|||
{
|
||||
isAlterTableRenameStmt = true;
|
||||
}
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
else if (renameStmt->renameType == OBJECT_TABCONSTRAINT)
|
||||
{
|
||||
isAlterTableRenameStmt = true;
|
||||
}
|
||||
#else
|
||||
else if (renameStmt->renameType == OBJECT_CONSTRAINT &&
|
||||
renameStmt->relationType == OBJECT_TABLE)
|
||||
{
|
||||
isAlterTableRenameStmt = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return isAlterTableRenameStmt;
|
||||
}
|
||||
|
@ -1113,21 +1104,12 @@ SetLocalCommitProtocolTo2PC(void)
|
|||
{
|
||||
ereport(DEBUG2, (errmsg("switching to 2PC for the transaction")));
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
set_config_option("citus.multi_shard_commit_protocol",
|
||||
"2pc",
|
||||
PGC_USERSET,
|
||||
PGC_S_SESSION,
|
||||
GUC_ACTION_LOCAL,
|
||||
true, 0, false);
|
||||
#else
|
||||
set_config_option("citus.multi_shard_commit_protocol",
|
||||
"2pc",
|
||||
PGC_USERSET,
|
||||
PGC_S_SESSION,
|
||||
GUC_ACTION_LOCAL,
|
||||
true, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1429,11 +1411,7 @@ CheckCopyPermissions(CopyStmt *copyStatement)
|
|||
|
||||
if (is_from)
|
||||
{
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
rte->insertedCols = bms_add_member(rte->insertedCols, attno);
|
||||
#else
|
||||
rte->modifiedCols = bms_add_member(rte->modifiedCols, attno);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1595,11 +1573,7 @@ ReplicateGrantStmt(Node *parsetree)
|
|||
isFirst = true;
|
||||
foreach(granteeCell, grantStmt->grantees)
|
||||
{
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
RoleSpec *spec = lfirst(granteeCell);
|
||||
#else
|
||||
PrivGrantee *spec = lfirst(granteeCell);
|
||||
#endif
|
||||
|
||||
if (!isFirst)
|
||||
{
|
||||
|
@ -1607,7 +1581,6 @@ ReplicateGrantStmt(Node *parsetree)
|
|||
}
|
||||
isFirst = false;
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
if (spec->roletype == ROLESPEC_CSTRING)
|
||||
{
|
||||
appendStringInfoString(&granteesString, quote_identifier(spec->rolename));
|
||||
|
@ -1624,16 +1597,6 @@ ReplicateGrantStmt(Node *parsetree)
|
|||
{
|
||||
appendStringInfoString(&granteesString, "PUBLIC");
|
||||
}
|
||||
#else
|
||||
if (spec->rolname)
|
||||
{
|
||||
appendStringInfoString(&granteesString, quote_identifier(spec->rolname));
|
||||
}
|
||||
else
|
||||
{
|
||||
appendStringInfoString(&granteesString, "PUBLIC");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -675,11 +675,7 @@ TableOwner(Oid relationId)
|
|||
|
||||
ReleaseSysCache(tuple);
|
||||
|
||||
#if (PG_VERSION_NUM < 90500)
|
||||
return GetUserNameFromId(userId);
|
||||
#else
|
||||
return GetUserNameFromId(userId, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,9 +40,7 @@
|
|||
#include "utils/builtins.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
#include "utils/ruleutils.h"
|
||||
#endif
|
||||
#include "utils/syscache.h"
|
||||
#include "utils/tqual.h"
|
||||
|
||||
|
@ -646,11 +644,7 @@ GetTableDDLEvents(Oid relationId)
|
|||
Oid constraintId = get_index_constraint(indexId);
|
||||
Assert(constraintId != InvalidOid);
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
statementDef = pg_get_constraintdef_command(constraintId);
|
||||
#else
|
||||
statementDef = pg_get_constraintdef_string(constraintId);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -43,12 +43,6 @@
|
|||
#include "utils/snapmgr.h"
|
||||
|
||||
|
||||
#if (PG_VERSION_NUM >= 90400 && PG_VERSION_NUM < 90500)
|
||||
|
||||
/* Crude hack to avoid changing sizeof(ExplainState) in released branches (explain.c) */
|
||||
#define grouping_stack extra->groupingstack
|
||||
#endif
|
||||
|
||||
/* OR-able flags for ExplainXMLTag() (explain.c) */
|
||||
#define X_OPENING 0
|
||||
#define X_CLOSING 1
|
||||
|
|
|
@ -50,9 +50,7 @@ static MultiNode * MultiPlanTree(Query *queryTree);
|
|||
static void ErrorIfQueryNotSupported(Query *queryTree);
|
||||
static bool HasUnsupportedJoinWalker(Node *node, void *context);
|
||||
static void ErrorIfSubqueryNotSupported(Query *subqueryTree);
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
static bool HasTablesample(Query *queryTree);
|
||||
#endif
|
||||
static bool HasOuterJoin(Query *queryTree);
|
||||
static bool HasOuterJoinWalker(Node *node, void *maxJoinLevel);
|
||||
static bool HasComplexJoinOrder(Query *queryTree);
|
||||
|
@ -356,9 +354,7 @@ static void
|
|||
ErrorIfQueryNotSupported(Query *queryTree)
|
||||
{
|
||||
char *errorDetail = NULL;
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
bool hasTablesample = false;
|
||||
#endif
|
||||
bool hasUnsupportedJoin = false;
|
||||
bool hasComplexJoinOrder = false;
|
||||
bool hasComplexRangeTableType = false;
|
||||
|
@ -412,7 +408,6 @@ ErrorIfQueryNotSupported(Query *queryTree)
|
|||
errorDetail = "Distinct clause is currently unsupported";
|
||||
}
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
if (queryTree->groupingSets)
|
||||
{
|
||||
preconditionsSatisfied = false;
|
||||
|
@ -425,7 +420,6 @@ ErrorIfQueryNotSupported(Query *queryTree)
|
|||
preconditionsSatisfied = false;
|
||||
errorDetail = "Tablesample is currently unsupported";
|
||||
}
|
||||
#endif
|
||||
|
||||
hasUnsupportedJoin = HasUnsupportedJoinWalker((Node *) queryTree->jointree, NULL);
|
||||
if (hasUnsupportedJoin)
|
||||
|
@ -458,8 +452,6 @@ ErrorIfQueryNotSupported(Query *queryTree)
|
|||
}
|
||||
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
|
||||
/* HasTablesample returns tree if the query contains tablesample */
|
||||
static bool
|
||||
HasTablesample(Query *queryTree)
|
||||
|
@ -482,9 +474,6 @@ HasTablesample(Query *queryTree)
|
|||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* HasUnsupportedJoinWalker returns tree if the query contains an unsupported
|
||||
* join type. We currently support inner, left, right, full and anti joins.
|
||||
|
|
|
@ -167,15 +167,9 @@ BuildAggregatePlan(Query *masterQuery, Plan *subPlan)
|
|||
}
|
||||
|
||||
/* finally create the plan */
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
aggregatePlan = make_agg(NULL, aggregateTargetList, NIL, aggregateStrategy,
|
||||
&aggregateCosts, groupColumnCount, groupColumnIdArray,
|
||||
groupColumnOpArray, NIL, rowEstimate, subPlan);
|
||||
#else
|
||||
aggregatePlan = make_agg(NULL, aggregateTargetList, NIL, aggregateStrategy,
|
||||
&aggregateCosts, groupColumnCount, groupColumnIdArray,
|
||||
groupColumnOpArray, rowEstimate, subPlan);
|
||||
#endif
|
||||
|
||||
return aggregatePlan;
|
||||
}
|
||||
|
|
|
@ -15,11 +15,7 @@
|
|||
|
||||
#include <stddef.h>
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500 && PG_VERSION_NUM < 90600)
|
||||
#include "access/stratnum.h"
|
||||
#else
|
||||
#include "access/skey.h"
|
||||
#endif
|
||||
#include "access/xact.h"
|
||||
#include "distributed/citus_clauses.h"
|
||||
#include "distributed/citus_nodes.h"
|
||||
|
@ -37,9 +33,7 @@
|
|||
#include "distributed/shardinterval_utils.h"
|
||||
#include "executor/execdesc.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
#include "nodes/makefuncs.h"
|
||||
#endif
|
||||
#include "nodes/nodeFuncs.h"
|
||||
#include "nodes/nodes.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
|
@ -154,12 +148,10 @@ ErrorIfModifyQueryNotSupported(Query *queryTree)
|
|||
bool hasValuesScan = false;
|
||||
uint32 queryTableCount = 0;
|
||||
bool specifiesPartitionValue = false;
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
ListCell *setTargetCell = NULL;
|
||||
List *onConflictSet = NIL;
|
||||
Node *arbiterWhere = NULL;
|
||||
Node *onConflictWhere = NULL;
|
||||
#endif
|
||||
|
||||
CmdType commandType = queryTree->commandType;
|
||||
Assert(commandType == CMD_INSERT || commandType == CMD_UPDATE ||
|
||||
|
@ -357,7 +349,6 @@ ErrorIfModifyQueryNotSupported(Query *queryTree)
|
|||
}
|
||||
}
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
if (commandType == CMD_INSERT && queryTree->onConflict != NULL)
|
||||
{
|
||||
onConflictSet = queryTree->onConflict->onConflictSet;
|
||||
|
@ -421,7 +412,6 @@ ErrorIfModifyQueryNotSupported(Query *queryTree)
|
|||
"clause of INSERTs on distributed tables must be marked "
|
||||
"IMMUTABLE")));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (specifiesPartitionValue)
|
||||
{
|
||||
|
@ -689,7 +679,6 @@ RouterModifyTask(Query *originalQuery, Query *query)
|
|||
/* grab shared metadata lock to stop concurrent placement additions */
|
||||
LockShardDistributionMetadata(shardId, ShareLock);
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
if (originalQuery->onConflict != NULL)
|
||||
{
|
||||
RangeTblEntry *rangeTableEntry = NULL;
|
||||
|
@ -705,11 +694,6 @@ RouterModifyTask(Query *originalQuery, Query *query)
|
|||
rangeTableEntry->alias = alias;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
/* always set to false for PG_VERSION_NUM < 90500 */
|
||||
upsertQuery = false;
|
||||
#endif
|
||||
|
||||
deparse_shard_query(originalQuery, shardInterval->relationId, shardId, queryString);
|
||||
ereport(DEBUG4, (errmsg("distributed statement: %s", queryString->data)));
|
||||
|
@ -1095,12 +1079,10 @@ MultiRouterPlannableQuery(Query *query, MultiExecutorType taskExecutorType)
|
|||
return false;
|
||||
}
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
if (query->groupingSets)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* only hash partitioned tables are supported */
|
||||
distributedTableId = ExtractFirstDistributedTableId(query);
|
||||
|
@ -1127,12 +1109,10 @@ MultiRouterPlannableQuery(Query *query, MultiExecutorType taskExecutorType)
|
|||
return false;
|
||||
}
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
if (rangeTableEntry->tablesample)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (joinTree == NULL)
|
||||
{
|
||||
|
|
|
@ -341,7 +341,6 @@ RelayEventExtendNames(Node *parseTree, char *schemaName, uint64 shardId)
|
|||
{
|
||||
ReindexStmt *reindexStmt = (ReindexStmt *) parseTree;
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
ReindexObjectType objectType = reindexStmt->kind;
|
||||
if (objectType == REINDEX_OBJECT_TABLE || objectType == REINDEX_OBJECT_INDEX)
|
||||
{
|
||||
|
@ -357,23 +356,6 @@ RelayEventExtendNames(Node *parseTree, char *schemaName, uint64 shardId)
|
|||
{
|
||||
ereport(ERROR, (errmsg("cannot extend name for multi-relation reindex")));
|
||||
}
|
||||
#else
|
||||
ObjectType objectType = reindexStmt->kind;
|
||||
if (objectType == OBJECT_TABLE || objectType == OBJECT_INDEX)
|
||||
{
|
||||
char **objectName = &(reindexStmt->relation->relname);
|
||||
char **objectSchemaName = &(reindexStmt->relation->schemaname);
|
||||
|
||||
/* prefix with schema name if it is not added already */
|
||||
SetSchemaNameIfNotExist(objectSchemaName, schemaName);
|
||||
|
||||
AppendShardIdToName(objectName, shardId);
|
||||
}
|
||||
else if (objectType == OBJECT_DATABASE)
|
||||
{
|
||||
ereport(ERROR, (errmsg("cannot extend name for multi-relation reindex")));
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
ereport(ERROR, (errmsg("invalid object type in reindex statement"),
|
||||
|
|
|
@ -34,16 +34,10 @@ static void FakeGetForeignRelSize(PlannerInfo *root, RelOptInfo *baserel,
|
|||
Oid foreigntableid);
|
||||
static void FakeGetForeignPaths(PlannerInfo *root, RelOptInfo *baserel,
|
||||
Oid foreigntableid);
|
||||
#if (PG_VERSION_NUM >= 90300 && PG_VERSION_NUM < 90500)
|
||||
static ForeignScan * FakeGetForeignPlan(PlannerInfo *root, RelOptInfo *baserel,
|
||||
Oid foreigntableid, ForeignPath *best_path,
|
||||
List *tlist, List *scan_clauses);
|
||||
#else
|
||||
static ForeignScan * FakeGetForeignPlan(PlannerInfo *root, RelOptInfo *baserel,
|
||||
Oid foreigntableid, ForeignPath *best_path,
|
||||
List *tlist, List *scan_clauses,
|
||||
Plan *outer_plan);
|
||||
#endif
|
||||
static void FakeBeginForeignScan(ForeignScanState *node, int eflags);
|
||||
static TupleTableSlot * FakeIterateForeignScan(ForeignScanState *node);
|
||||
static void FakeReScanForeignScan(ForeignScanState *node);
|
||||
|
@ -95,42 +89,25 @@ FakeGetForeignPaths(PlannerInfo *root, RelOptInfo *baserel, Oid foreigntableid)
|
|||
Cost startup_cost = 0;
|
||||
Cost total_cost = startup_cost + baserel->rows;
|
||||
|
||||
#if (PG_VERSION_NUM >= 90300 && PG_VERSION_NUM < 90500)
|
||||
add_path(baserel, (Path *) create_foreignscan_path(root, baserel, baserel->rows,
|
||||
startup_cost, total_cost, NIL,
|
||||
NULL, NIL));
|
||||
#else
|
||||
add_path(baserel, (Path *) create_foreignscan_path(root, baserel, baserel->rows,
|
||||
startup_cost, total_cost, NIL,
|
||||
NULL, NULL, NIL));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FakeGetForeignPlan builds a fake foreign plan.
|
||||
*/
|
||||
#if (PG_VERSION_NUM >= 90300 && PG_VERSION_NUM < 90500)
|
||||
static ForeignScan *
|
||||
FakeGetForeignPlan(PlannerInfo *root, RelOptInfo *baserel, Oid foreigntableid,
|
||||
ForeignPath *best_path, List *tlist, List *scan_clauses)
|
||||
#else
|
||||
static ForeignScan *
|
||||
FakeGetForeignPlan(PlannerInfo * root, RelOptInfo * baserel, Oid foreigntableid,
|
||||
ForeignPath * best_path, List * tlist, List * scan_clauses,
|
||||
Plan * outer_plan)
|
||||
#endif
|
||||
ForeignPath *best_path, List *tlist, List *scan_clauses,
|
||||
Plan *outer_plan)
|
||||
{
|
||||
Index scan_relid = baserel->relid;
|
||||
scan_clauses = extract_actual_clauses(scan_clauses, false);
|
||||
|
||||
/* make_foreignscan has a different signature in 9.3 and 9.4 than in 9.5 */
|
||||
#if (PG_VERSION_NUM >= 90300 && PG_VERSION_NUM < 90500)
|
||||
return make_foreignscan(tlist, scan_clauses, scan_relid, NIL, NIL);
|
||||
#else
|
||||
return make_foreignscan(tlist, scan_clauses, scan_relid, NIL, NIL, NIL, NIL,
|
||||
outer_plan);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,11 +16,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500 && PG_VERSION_NUM < 90600)
|
||||
#include "access/stratnum.h"
|
||||
#else
|
||||
#include "access/skey.h"
|
||||
#endif
|
||||
#include "catalog/pg_type.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "distributed/master_metadata_utility.h"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -46,9 +46,7 @@
|
|||
#include "utils/fmgroids.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/rel.h"
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
#include "utils/ruleutils.h"
|
||||
#endif
|
||||
#include "utils/syscache.h"
|
||||
#include "utils/typcache.h"
|
||||
#include "utils/xml.h"
|
||||
|
|
|
@ -725,11 +725,7 @@ CurrentUserName(void)
|
|||
{
|
||||
Oid userId = GetUserId();
|
||||
|
||||
#if (PG_VERSION_NUM < 90500)
|
||||
return GetUserNameFromId(userId);
|
||||
#else
|
||||
return GetUserNameFromId(userId, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -265,11 +265,7 @@ CreateJobSchema(StringInfo schemaName)
|
|||
/* build a CREATE SCHEMA statement */
|
||||
CreateSchemaStmt *createSchemaStmt = makeNode(CreateSchemaStmt);
|
||||
createSchemaStmt->schemaname = schemaName->data;
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
createSchemaStmt->authrole = NULL;
|
||||
#else
|
||||
createSchemaStmt->authid = NULL;
|
||||
#endif
|
||||
createSchemaStmt->schemaElts = NIL;
|
||||
|
||||
/* allow schema names that start with pg_ */
|
||||
|
|
|
@ -369,9 +369,7 @@ CreateTaskTable(StringInfo schemaName, StringInfo relationName,
|
|||
RangeVar *relation = NULL;
|
||||
List *columnDefinitionList = NIL;
|
||||
Oid relationId PG_USED_FOR_ASSERTS_ONLY = InvalidOid;
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
ObjectAddress relationObject;
|
||||
#endif
|
||||
|
||||
Assert(schemaName != NULL);
|
||||
Assert(relationName != NULL);
|
||||
|
@ -386,12 +384,8 @@ CreateTaskTable(StringInfo schemaName, StringInfo relationName,
|
|||
|
||||
createStatement = CreateStatement(relation, columnDefinitionList);
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
relationObject = DefineRelation(createStatement, RELKIND_RELATION, InvalidOid, NULL);
|
||||
relationId = relationObject.objectId;
|
||||
#else
|
||||
relationId = DefineRelation(createStatement, RELKIND_RELATION, InvalidOid);
|
||||
#endif
|
||||
|
||||
Assert(relationId != InvalidOid);
|
||||
CommandCounterIncrement();
|
||||
|
|
|
@ -31,12 +31,6 @@
|
|||
#include <sys/stat.h> /* for stat() */
|
||||
#endif
|
||||
|
||||
#if (PG_VERSION_NUM >= 90400 && PG_VERSION_NUM < 90500)
|
||||
#ifdef USE_SSL
|
||||
#include <openssl/ssl.h>
|
||||
#endif /* USE_SSL */
|
||||
#endif /* (PG_VERSION_NUM >= 90400 && PG_VERSION_NUM < 90500) */
|
||||
|
||||
#include "portability/instr_time.h"
|
||||
|
||||
#include "libpq-fe.h"
|
||||
|
@ -1898,7 +1892,6 @@ connection_warnings(bool in_startup)
|
|||
*
|
||||
* Prints information about the current SSL connection, if SSL is in use
|
||||
*/
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
static void
|
||||
printSSLInfo(void)
|
||||
{
|
||||
|
@ -1921,34 +1914,6 @@ printSSLInfo(void)
|
|||
bits ? bits : _("unknown"),
|
||||
(compression && strcmp(compression, "off") != 0) ? _("on") : _("off"));
|
||||
}
|
||||
#else
|
||||
static void
|
||||
printSSLInfo(void)
|
||||
{
|
||||
#ifdef USE_SSL
|
||||
int sslbits = -1;
|
||||
SSL *ssl;
|
||||
|
||||
ssl = PQgetssl(pset.db);
|
||||
if (!ssl)
|
||||
return; /* no SSL */
|
||||
|
||||
SSL_get_cipher_bits(ssl, &sslbits);
|
||||
printf(_("SSL connection (protocol: %s, cipher: %s, bits: %d, compression: %s)\n"),
|
||||
SSL_get_version(ssl), SSL_get_cipher(ssl), sslbits,
|
||||
SSL_get_current_compression(ssl) ? _("on") : _("off"));
|
||||
#else
|
||||
|
||||
/*
|
||||
* If psql is compiled without SSL but is using a libpq with SSL, we
|
||||
* cannot figure out the specifics about the connection. But we know it's
|
||||
* SSL secured.
|
||||
*/
|
||||
if (PQgetssl(pset.db))
|
||||
printf(_("SSL connection (unknown cipher)\n"));
|
||||
#endif /* USE_SSL */
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* checkWin32Codepage
|
||||
|
|
|
@ -19,14 +19,7 @@
|
|||
extern bool openQueryOutputFile(const char *fname, FILE **fout, bool *is_pipe);
|
||||
extern bool setQFout(const char *fname);
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
extern void psql_error(const char *fmt,...) pg_attribute_printf(1, 2);
|
||||
#else
|
||||
extern void
|
||||
psql_error(const char *fmt,...)
|
||||
/* This lets gcc check the format string for consistency. */
|
||||
__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
|
||||
#endif
|
||||
|
||||
extern void NoticeProcessor(void *arg, const char *message);
|
||||
|
||||
|
|
|
@ -12,13 +12,7 @@
|
|||
#include "settings.h"
|
||||
#include "common.h"
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
static void print_lo_result(const char *fmt,...) pg_attribute_printf(1, 2);
|
||||
#else
|
||||
static void
|
||||
print_lo_result(const char *fmt,...)
|
||||
__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
|
||||
#endif
|
||||
|
||||
static void
|
||||
print_lo_result(const char *fmt,...)
|
||||
|
|
|
@ -24,11 +24,9 @@
|
|||
#define INVALID_JOB_ID 0
|
||||
#define INVALID_TASK_ID 0
|
||||
|
||||
#if (PG_VERSION_NUM >= 90500)
|
||||
|
||||
/* reserved alias name for UPSERTs */
|
||||
#define UPSERT_ALIAS "citus_table_alias"
|
||||
#endif
|
||||
|
||||
|
||||
extern MultiPlan * MultiRouterPlanCreate(Query *originalQuery, Query *query,
|
||||
MultiExecutorType taskExecutorType);
|
||||
|
|
|
@ -1,332 +0,0 @@
|
|||
-- this test file aims to test UPSERT feature on Citus
|
||||
-- note that output of this file for postgresql 9.4 will
|
||||
-- be full syntax errors, which is expected.
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 980000;
|
||||
ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 980000;
|
||||
CREATE TABLE upsert_test
|
||||
(
|
||||
part_key int UNIQUE,
|
||||
other_col int,
|
||||
third_col int
|
||||
);
|
||||
-- distribute the table and create shards
|
||||
SELECT master_create_distributed_table('upsert_test', 'part_key', 'hash');
|
||||
master_create_distributed_table
|
||||
---------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT master_create_worker_shards('upsert_test', '4', '2');
|
||||
master_create_worker_shards
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- do a regular insert
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1);
|
||||
-- observe that there is a conflict and the following query does nothing
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLICT DO NOTHING;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...O upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLIC...
|
||||
^
|
||||
-- same as the above with different syntax
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLICT (part_key) DO NOTHING;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...O upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLIC...
|
||||
^
|
||||
--again the same query with another syntax
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLICT ON CONSTRAINT upsert_test_part_key_key DO NOTHING;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...O upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLIC...
|
||||
^
|
||||
-- now, update the columns
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1)
|
||||
ON CONFLICT (part_key) DO UPDATE SET other_col = 2, third_col = 4;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 2: ON CONFLICT (part_key) DO UPDATE SET other_col = 2, third_...
|
||||
^
|
||||
-- see the results
|
||||
SELECT * FROM upsert_test;
|
||||
part_key | other_col | third_col
|
||||
----------+-----------+-----------
|
||||
1 | 1 |
|
||||
(1 row)
|
||||
|
||||
-- use a WHERE clause, so that SET doesn't have an affect
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLICT (part_key)
|
||||
DO UPDATE SET other_col = 30 WHERE upsert_test.other_col = 3;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...O upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLIC...
|
||||
^
|
||||
-- see the results
|
||||
SELECT * FROM upsert_test;
|
||||
part_key | other_col | third_col
|
||||
----------+-----------+-----------
|
||||
1 | 1 |
|
||||
(1 row)
|
||||
|
||||
-- use a WHERE clause, that hits the row and updates it
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLICT (part_key)
|
||||
DO UPDATE SET other_col = 30 WHERE upsert_test.other_col = 2;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...O upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLIC...
|
||||
^
|
||||
-- see the results
|
||||
SELECT * FROM upsert_test;
|
||||
part_key | other_col | third_col
|
||||
----------+-----------+-----------
|
||||
1 | 1 |
|
||||
(1 row)
|
||||
|
||||
-- use two elements in the WHERE, that doesn't hit the row and updates it
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLICT (part_key)
|
||||
DO UPDATE SET other_col = 30 WHERE upsert_test.other_col = 2 AND upsert_test.other_col = 3;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...O upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLIC...
|
||||
^
|
||||
-- use EXCLUDED keyword
|
||||
INSERT INTO upsert_test (part_key, other_col, third_col) VALUES (1, 1, 100) ON CONFLICT (part_key)
|
||||
DO UPDATE SET other_col = EXCLUDED.third_col;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...art_key, other_col, third_col) VALUES (1, 1, 100) ON CONFLIC...
|
||||
^
|
||||
-- see the results
|
||||
SELECT * FROM upsert_test;
|
||||
part_key | other_col | third_col
|
||||
----------+-----------+-----------
|
||||
1 | 1 |
|
||||
(1 row)
|
||||
|
||||
-- now update multiple columns with ALIAS table and reference to the row itself
|
||||
INSERT INTO upsert_test as ups_test (part_key) VALUES (1)
|
||||
ON CONFLICT (part_key) DO UPDATE SET other_col = ups_test.other_col + 50, third_col = 200;
|
||||
ERROR: syntax error at or near "as"
|
||||
LINE 1: INSERT INTO upsert_test as ups_test (part_key) VALUES (1)
|
||||
^
|
||||
-- see the results
|
||||
SELECT * FROM upsert_test;
|
||||
part_key | other_col | third_col
|
||||
----------+-----------+-----------
|
||||
1 | 1 |
|
||||
(1 row)
|
||||
|
||||
-- now, do some more complex assignments
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLICT (part_key)
|
||||
DO UPDATE SET other_col = upsert_test.other_col + 1,
|
||||
third_col = upsert_test.third_col + (EXCLUDED.part_key + EXCLUDED.other_col) + 670;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...O upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLIC...
|
||||
^
|
||||
-- see the results
|
||||
SELECT * FROM upsert_test;
|
||||
part_key | other_col | third_col
|
||||
----------+-----------+-----------
|
||||
1 | 1 |
|
||||
(1 row)
|
||||
|
||||
-- now, WHERE clause also has table reference
|
||||
INSERT INTO upsert_test as ups_test (part_key, other_col) VALUES (1, 1) ON CONFLICT (part_key)
|
||||
DO UPDATE SET other_col = (ups_test.other_col + ups_test.third_col + (EXCLUDED.part_key + EXCLUDED.other_col)) % 15
|
||||
WHERE ups_test.third_col < 1000 + ups_test.other_col;
|
||||
ERROR: syntax error at or near "as"
|
||||
LINE 1: INSERT INTO upsert_test as ups_test (part_key, other_col) VA...
|
||||
^
|
||||
-- see the results
|
||||
SELECT * FROM upsert_test;
|
||||
part_key | other_col | third_col
|
||||
----------+-----------+-----------
|
||||
1 | 1 |
|
||||
(1 row)
|
||||
|
||||
-- Test upsert, with returning:
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (2, 2)
|
||||
ON CONFLICT (part_key) DO UPDATE SET other_col = 3
|
||||
RETURNING *;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 2: ON CONFLICT (part_key) DO UPDATE SET other_col = 3
|
||||
^
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (2, 2)
|
||||
ON CONFLICT (part_key) DO UPDATE SET other_col = 3
|
||||
RETURNING *;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 2: ON CONFLICT (part_key) DO UPDATE SET other_col = 3
|
||||
^
|
||||
-- create another table
|
||||
CREATE TABLE upsert_test_2
|
||||
(
|
||||
part_key int,
|
||||
other_col int,
|
||||
third_col int,
|
||||
PRIMARY KEY (part_key, other_col)
|
||||
);
|
||||
-- distribute the table and create shards
|
||||
SELECT master_create_distributed_table('upsert_test_2', 'part_key', 'hash');
|
||||
master_create_distributed_table
|
||||
---------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT master_create_worker_shards('upsert_test_2', '4', '2');
|
||||
master_create_worker_shards
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- now show that Citus works with multiple columns as the PRIMARY KEY, including the partiton key
|
||||
INSERT INTO upsert_test_2 (part_key, other_col) VALUES (1, 1);
|
||||
INSERT INTO upsert_test_2 (part_key, other_col) VALUES (1, 1) ON CONFLICT (part_key, other_col) DO NOTHING;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...upsert_test_2 (part_key, other_col) VALUES (1, 1) ON CONFLIC...
|
||||
^
|
||||
-- this errors out since there is no unique constraint on partition key
|
||||
INSERT INTO upsert_test_2 (part_key, other_col) VALUES (1, 1) ON CONFLICT (part_key) DO NOTHING;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...upsert_test_2 (part_key, other_col) VALUES (1, 1) ON CONFLIC...
|
||||
^
|
||||
-- create another table
|
||||
CREATE TABLE upsert_test_3
|
||||
(
|
||||
part_key int,
|
||||
count int
|
||||
);
|
||||
-- note that this is not a unique index
|
||||
CREATE INDEX idx_ups_test ON upsert_test_3(part_key);
|
||||
-- distribute the table and create shards
|
||||
SELECT master_create_distributed_table('upsert_test_3', 'part_key', 'hash');
|
||||
master_create_distributed_table
|
||||
---------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT master_create_worker_shards('upsert_test_3', '4', '2');
|
||||
master_create_worker_shards
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- since there are no unique indexes, error-out
|
||||
INSERT INTO upsert_test_3 VALUES (1, 0) ON CONFLICT(part_key) DO UPDATE SET count = upsert_test_3.count + 1;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: INSERT INTO upsert_test_3 VALUES (1, 0) ON CONFLICT(part_key...
|
||||
^
|
||||
-- create another table
|
||||
CREATE TABLE upsert_test_4
|
||||
(
|
||||
part_key int UNIQUE,
|
||||
count int
|
||||
);
|
||||
-- distribute the table and create shards
|
||||
SELECT master_create_distributed_table('upsert_test_4', 'part_key', 'hash');
|
||||
master_create_distributed_table
|
||||
---------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT master_create_worker_shards('upsert_test_4', '4', '2');
|
||||
master_create_worker_shards
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
-- a single row insert
|
||||
INSERT INTO upsert_test_4 VALUES (1, 0);
|
||||
-- show a simple count example use case
|
||||
INSERT INTO upsert_test_4 VALUES (1, 0) ON CONFLICT(part_key) DO UPDATE SET count = upsert_test_4.count + 1;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: INSERT INTO upsert_test_4 VALUES (1, 0) ON CONFLICT(part_key...
|
||||
^
|
||||
INSERT INTO upsert_test_4 VALUES (1, 0) ON CONFLICT(part_key) DO UPDATE SET count = upsert_test_4.count + 1;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: INSERT INTO upsert_test_4 VALUES (1, 0) ON CONFLICT(part_key...
|
||||
^
|
||||
INSERT INTO upsert_test_4 VALUES (1, 0) ON CONFLICT(part_key) DO UPDATE SET count = upsert_test_4.count + 1;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: INSERT INTO upsert_test_4 VALUES (1, 0) ON CONFLICT(part_key...
|
||||
^
|
||||
INSERT INTO upsert_test_4 VALUES (1, 0) ON CONFLICT(part_key) DO UPDATE SET count = upsert_test_4.count + 1;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: INSERT INTO upsert_test_4 VALUES (1, 0) ON CONFLICT(part_key...
|
||||
^
|
||||
INSERT INTO upsert_test_4 VALUES (1, 0) ON CONFLICT(part_key) DO UPDATE SET count = upsert_test_4.count + 1;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: INSERT INTO upsert_test_4 VALUES (1, 0) ON CONFLICT(part_key...
|
||||
^
|
||||
INSERT INTO upsert_test_4 VALUES (1, 0) ON CONFLICT(part_key) DO UPDATE SET count = upsert_test_4.count + 1;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: INSERT INTO upsert_test_4 VALUES (1, 0) ON CONFLICT(part_key...
|
||||
^
|
||||
-- now see the results
|
||||
SELECT * FROM upsert_test_4;
|
||||
part_key | count
|
||||
----------+-------
|
||||
1 | 0
|
||||
(1 row)
|
||||
|
||||
-- now test dropped columns
|
||||
CREATE TABLE dropcol_distributed(key int primary key, drop1 int, keep1 text, drop2 numeric, keep2 float);
|
||||
SELECT master_create_distributed_table('dropcol_distributed', 'key', 'hash');
|
||||
master_create_distributed_table
|
||||
---------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
SELECT master_create_worker_shards('dropcol_distributed', 4, 1);
|
||||
master_create_worker_shards
|
||||
-----------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
INSERT INTO dropcol_distributed AS dropcol (key, keep1, keep2) VALUES (1, '5', 5) ON CONFLICT(key)
|
||||
DO UPDATE SET keep1 = dropcol.keep1;
|
||||
ERROR: syntax error at or near "AS"
|
||||
LINE 1: INSERT INTO dropcol_distributed AS dropcol (key, keep1, keep...
|
||||
^
|
||||
ALTER TABLE dropcol_distributed DROP COLUMN drop2;
|
||||
INSERT INTO dropcol_distributed (key, keep1, keep2) VALUES (1, '5', 5) ON CONFLICT(key)
|
||||
DO UPDATE SET keep1 = dropcol_distributed.keep1;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...istributed (key, keep1, keep2) VALUES (1, '5', 5) ON CONFLIC...
|
||||
^
|
||||
ALTER TABLE dropcol_distributed DROP COLUMN keep2;
|
||||
INSERT INTO dropcol_distributed AS dropcol (key, keep1) VALUES (1, '5') ON CONFLICT(key)
|
||||
DO UPDATE SET keep1 = dropcol.keep1;
|
||||
ERROR: syntax error at or near "AS"
|
||||
LINE 1: INSERT INTO dropcol_distributed AS dropcol (key, keep1) VALU...
|
||||
^
|
||||
ALTER TABLE dropcol_distributed DROP COLUMN drop1;
|
||||
INSERT INTO dropcol_distributed AS dropcol (key, keep1) VALUES (1, '5') ON CONFLICT(key)
|
||||
DO UPDATE SET keep1 = dropcol.keep1;
|
||||
ERROR: syntax error at or near "AS"
|
||||
LINE 1: INSERT INTO dropcol_distributed AS dropcol (key, keep1) VALU...
|
||||
^
|
||||
-- below we test the cases that Citus does not support
|
||||
-- subquery in the SET clause
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLICT (part_key) DO
|
||||
UPDATE SET other_col = (SELECT count(*) from upsert_test);
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...O upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLIC...
|
||||
^
|
||||
-- non mutable function call in the SET
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLICT (part_key) DO
|
||||
UPDATE SET other_col = random()::int;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...O upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLIC...
|
||||
^
|
||||
-- non mutable function call in the WHERE
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLICT (part_key) DO
|
||||
UPDATE SET other_col = 5 WHERE upsert_test.other_col = random()::int;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...O upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLIC...
|
||||
^
|
||||
-- non mutable function call in the arbiter WHERE
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLICT (part_key) WHERE part_key = random()::int
|
||||
DO UPDATE SET other_col = 5;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...O upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLIC...
|
||||
^
|
||||
-- error out on attempt to update the partition key
|
||||
INSERT INTO upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLICT (part_key) DO
|
||||
UPDATE SET part_key = 15;
|
||||
ERROR: syntax error at or near "ON"
|
||||
LINE 1: ...O upsert_test (part_key, other_col) VALUES (1, 1) ON CONFLIC...
|
||||
^
|
Loading…
Reference in New Issue