mirror of https://github.com/citusdata/citus.git
parent
26f5e20580
commit
3799f95742
|
@ -10,6 +10,8 @@
|
|||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include "pg_version_compat.h"
|
||||
|
||||
#include "access/htup_details.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/pg_collation.h"
|
||||
|
@ -521,7 +523,7 @@ GenerateBackupNameForCollationCollision(const ObjectAddress *address)
|
|||
return NULL;
|
||||
}
|
||||
Form_pg_collation collationForm = (Form_pg_collation) GETSTRUCT(collationTuple);
|
||||
Value *namespace = makeString(get_namespace_name(collationForm->collnamespace));
|
||||
String *namespace = makeString(get_namespace_name(collationForm->collnamespace));
|
||||
ReleaseSysCache(collationTuple);
|
||||
|
||||
while (true)
|
||||
|
|
|
@ -115,7 +115,7 @@ AlterDatabaseOwnerObjectAddress(Node *node, bool missing_ok)
|
|||
AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node);
|
||||
Assert(stmt->objectType == OBJECT_DATABASE);
|
||||
|
||||
Oid databaseOid = get_database_oid(strVal((Value *) stmt->object), missing_ok);
|
||||
Oid databaseOid = get_database_oid(strVal((String *) stmt->object), missing_ok);
|
||||
ObjectAddress address = { 0 };
|
||||
ObjectAddressSet(address, DatabaseRelationId, databaseOid);
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ FilterDistributedExtensions(List *extensionObjectList)
|
|||
{
|
||||
List *extensionNameList = NIL;
|
||||
|
||||
Value *objectName = NULL;
|
||||
String *objectName = NULL;
|
||||
foreach_ptr(objectName, extensionObjectList)
|
||||
{
|
||||
const char *extensionName = strVal(objectName);
|
||||
|
@ -334,7 +334,7 @@ ExtensionNameListToObjectAddressList(List *extensionObjectList)
|
|||
{
|
||||
List *extensionObjectAddressList = NIL;
|
||||
|
||||
Value *objectName;
|
||||
String *objectName;
|
||||
foreach_ptr(objectName, extensionObjectList)
|
||||
{
|
||||
/*
|
||||
|
@ -671,7 +671,7 @@ IsDropCitusExtensionStmt(Node *parseTree)
|
|||
}
|
||||
|
||||
/* now that we have a DropStmt, check if citus extension is among the objects to dropped */
|
||||
Value *objectName;
|
||||
String *objectName;
|
||||
foreach_ptr(objectName, dropStmt->objects)
|
||||
{
|
||||
const char *extensionName = strVal(objectName);
|
||||
|
|
|
@ -190,7 +190,7 @@ PreprocessDropForeignServerStmt(Node *node, const char *queryString,
|
|||
|
||||
Assert(list_length(stmt->objects) == 1);
|
||||
|
||||
Value *serverValue = linitial(stmt->objects);
|
||||
String *serverValue = linitial(stmt->objects);
|
||||
ObjectAddress address = GetObjectAddressByServerName(strVal(serverValue), false);
|
||||
|
||||
/* unmark distributed server */
|
||||
|
@ -362,7 +362,7 @@ RecreateForeignServerStmt(Oid serverId)
|
|||
static bool
|
||||
NameListHasDistributedServer(List *serverNames)
|
||||
{
|
||||
Value *serverValue = NULL;
|
||||
String *serverValue = NULL;
|
||||
foreach_ptr(serverValue, serverNames)
|
||||
{
|
||||
ObjectAddress address = GetObjectAddressByServerName(strVal(serverValue), false);
|
||||
|
|
|
@ -1893,7 +1893,7 @@ AlterFunctionSchemaStmtObjectAddress(Node *node, bool missing_ok)
|
|||
*/
|
||||
|
||||
/* the name of the function is the last in the list of names */
|
||||
Value *funcNameStr = lfirst(list_tail(names));
|
||||
String *funcNameStr = lfirst(list_tail(names));
|
||||
List *newNames = list_make2(makeString(stmt->newschema), funcNameStr);
|
||||
|
||||
/*
|
||||
|
@ -1938,8 +1938,8 @@ GenerateBackupNameForProcCollision(const ObjectAddress *address)
|
|||
char *newName = palloc0(NAMEDATALEN);
|
||||
char suffix[NAMEDATALEN] = { 0 };
|
||||
int count = 0;
|
||||
Value *namespace = makeString(get_namespace_name(get_func_namespace(
|
||||
address->objectId)));
|
||||
String *namespace = makeString(get_namespace_name(get_func_namespace(
|
||||
address->objectId)));
|
||||
char *baseName = get_func_name(address->objectId);
|
||||
int baseLength = strlen(baseName);
|
||||
Oid *argtypes = NULL;
|
||||
|
|
|
@ -2009,7 +2009,7 @@ CitusCopyDestReceiverStartup(DestReceiver *dest, int operation,
|
|||
foreach(columnNameCell, columnNameList)
|
||||
{
|
||||
char *columnName = (char *) lfirst(columnNameCell);
|
||||
Value *columnNameValue = makeString(columnName);
|
||||
String *columnNameValue = makeString(columnName);
|
||||
|
||||
attributeList = lappend(attributeList, columnNameValue);
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ PostprocessAlterRoleStmt(Node *node, const char *queryString)
|
|||
|
||||
if (encryptedPassword != NULL)
|
||||
{
|
||||
Value *encryptedPasswordValue = makeString((char *) encryptedPassword);
|
||||
String *encryptedPasswordValue = makeString((char *) encryptedPassword);
|
||||
option->arg = (Node *) encryptedPasswordValue;
|
||||
}
|
||||
else
|
||||
|
@ -741,8 +741,13 @@ makeStringConst(char *str, int location)
|
|||
{
|
||||
A_Const *n = makeNode(A_Const);
|
||||
|
||||
#if PG_VERSION_NUM >= PG_VERSION_15
|
||||
n->val.sval.type = T_String;
|
||||
n->val.sval.sval = str;
|
||||
#else
|
||||
n->val.type = T_String;
|
||||
n->val.val.str = str;
|
||||
#endif
|
||||
n->location = location;
|
||||
|
||||
return (Node *) n;
|
||||
|
@ -759,8 +764,13 @@ makeIntConst(int val, int location)
|
|||
{
|
||||
A_Const *n = makeNode(A_Const);
|
||||
|
||||
#if PG_VERSION_NUM >= PG_VERSION_15
|
||||
n->val.ival.type = T_Integer;
|
||||
n->val.ival.ival = val;
|
||||
#else
|
||||
n->val.type = T_Integer;
|
||||
n->val.val.ival = val;
|
||||
#endif
|
||||
n->location = location;
|
||||
|
||||
return (Node *) n;
|
||||
|
@ -777,8 +787,13 @@ makeFloatConst(char *str, int location)
|
|||
{
|
||||
A_Const *n = makeNode(A_Const);
|
||||
|
||||
#if PG_VERSION_NUM >= PG_VERSION_15
|
||||
n->val.fval.type = T_Float;
|
||||
n->val.fval.fval = str;
|
||||
#else
|
||||
n->val.type = T_Float;
|
||||
n->val.val.str = str;
|
||||
#endif
|
||||
n->location = location;
|
||||
|
||||
return (Node *) n;
|
||||
|
|
|
@ -107,7 +107,7 @@ PreprocessDropSchemaStmt(Node *node, const char *queryString,
|
|||
|
||||
EnsureSequentialMode(OBJECT_SCHEMA);
|
||||
|
||||
Value *schemaVal = NULL;
|
||||
String *schemaVal = NULL;
|
||||
foreach_ptr(schemaVal, distributedSchemas)
|
||||
{
|
||||
if (SchemaHasDistributedTableWithFKey(strVal(schemaVal)))
|
||||
|
@ -288,7 +288,7 @@ FilterDistributedSchemas(List *schemas)
|
|||
{
|
||||
List *distributedSchemas = NIL;
|
||||
|
||||
Value *schemaValue = NULL;
|
||||
String *schemaValue = NULL;
|
||||
foreach_ptr(schemaValue, schemas)
|
||||
{
|
||||
const char *schemaName = strVal(schemaValue);
|
||||
|
|
|
@ -295,7 +295,7 @@ PostprocessAlterStatisticsSchemaStmt(Node *node, const char *queryString)
|
|||
AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node);
|
||||
Assert(stmt->objectType == OBJECT_STATISTIC_EXT);
|
||||
|
||||
Value *statName = llast((List *) stmt->object);
|
||||
String *statName = llast((List *) stmt->object);
|
||||
Oid statsOid = get_statistics_object_oid(list_make2(makeString(stmt->newschema),
|
||||
statName), false);
|
||||
Oid relationId = GetRelIdByStatsOid(statsOid);
|
||||
|
@ -328,7 +328,7 @@ AlterStatisticsSchemaStmtObjectAddress(Node *node, bool missingOk)
|
|||
AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node);
|
||||
|
||||
ObjectAddress address = { 0 };
|
||||
Value *statName = llast((List *) stmt->object);
|
||||
String *statName = llast((List *) stmt->object);
|
||||
Oid statsOid = get_statistics_object_oid(list_make2(makeString(stmt->newschema),
|
||||
statName), missingOk);
|
||||
ObjectAddressSet(address, StatisticExtRelationId, statsOid);
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
|
||||
/* local function forward declarations */
|
||||
static bool IsCreateCitusTruncateTriggerStmt(CreateTrigStmt *createTriggerStmt);
|
||||
static Value * GetAlterTriggerDependsTriggerNameValue(AlterObjectDependsStmt *
|
||||
alterTriggerDependsStmt);
|
||||
static String * GetAlterTriggerDependsTriggerNameValue(AlterObjectDependsStmt *
|
||||
alterTriggerDependsStmt);
|
||||
static void ErrorIfUnsupportedDropTriggerCommand(DropStmt *dropTriggerStmt);
|
||||
static RangeVar * GetDropTriggerStmtRelation(DropStmt *dropTriggerStmt);
|
||||
static void ExtractDropStmtTriggerAndRelationName(DropStmt *dropTriggerStmt,
|
||||
|
@ -416,7 +416,7 @@ PreprocessAlterTriggerDependsStmt(Node *node, const char *queryString,
|
|||
* workers
|
||||
*/
|
||||
|
||||
Value *triggerNameValue =
|
||||
String *triggerNameValue =
|
||||
GetAlterTriggerDependsTriggerNameValue(alterTriggerDependsStmt);
|
||||
ereport(ERROR, (errmsg(
|
||||
"Triggers \"%s\" on distributed tables and local tables added to metadata "
|
||||
|
@ -454,7 +454,7 @@ PostprocessAlterTriggerDependsStmt(Node *node, const char *queryString)
|
|||
EnsureCoordinator();
|
||||
ErrorOutForTriggerIfNotSupported(relationId);
|
||||
|
||||
Value *triggerNameValue =
|
||||
String *triggerNameValue =
|
||||
GetAlterTriggerDependsTriggerNameValue(alterTriggerDependsStmt);
|
||||
return CitusCreateTriggerCommandDDLJob(relationId, strVal(triggerNameValue),
|
||||
queryString);
|
||||
|
@ -476,7 +476,7 @@ AlterTriggerDependsEventExtendNames(AlterObjectDependsStmt *alterTriggerDependsS
|
|||
char **relationName = &(relation->relname);
|
||||
AppendShardIdToName(relationName, shardId);
|
||||
|
||||
Value *triggerNameValue =
|
||||
String *triggerNameValue =
|
||||
GetAlterTriggerDependsTriggerNameValue(alterTriggerDependsStmt);
|
||||
AppendShardIdToName(&strVal(triggerNameValue), shardId);
|
||||
|
||||
|
@ -489,7 +489,7 @@ AlterTriggerDependsEventExtendNames(AlterObjectDependsStmt *alterTriggerDependsS
|
|||
* GetAlterTriggerDependsTriggerName returns Value object for the trigger
|
||||
* name that given AlterObjectDependsStmt is executed for.
|
||||
*/
|
||||
static Value *
|
||||
static String *
|
||||
GetAlterTriggerDependsTriggerNameValue(AlterObjectDependsStmt *alterTriggerDependsStmt)
|
||||
{
|
||||
List *triggerObjectNameList = (List *) alterTriggerDependsStmt->object;
|
||||
|
@ -503,7 +503,7 @@ GetAlterTriggerDependsTriggerNameValue(AlterObjectDependsStmt *alterTriggerDepen
|
|||
* be the name of the trigger in either before or after standard process
|
||||
* utility.
|
||||
*/
|
||||
Value *triggerNameValue = llast(triggerObjectNameList);
|
||||
String *triggerNameValue = llast(triggerObjectNameList);
|
||||
return triggerNameValue;
|
||||
}
|
||||
|
||||
|
@ -642,12 +642,12 @@ DropTriggerEventExtendNames(DropStmt *dropTriggerStmt, char *schemaName, uint64
|
|||
ExtractDropStmtTriggerAndRelationName(dropTriggerStmt, &triggerName, &relationName);
|
||||
|
||||
AppendShardIdToName(&triggerName, shardId);
|
||||
Value *triggerNameValue = makeString(triggerName);
|
||||
String *triggerNameValue = makeString(triggerName);
|
||||
|
||||
AppendShardIdToName(&relationName, shardId);
|
||||
Value *relationNameValue = makeString(relationName);
|
||||
String *relationNameValue = makeString(relationName);
|
||||
|
||||
Value *schemaNameValue = makeString(pstrdup(schemaName));
|
||||
String *schemaNameValue = makeString(pstrdup(schemaName));
|
||||
|
||||
List *shardTriggerNameList =
|
||||
list_make3(schemaNameValue, relationNameValue, triggerNameValue);
|
||||
|
|
|
@ -878,7 +878,7 @@ AlterTypeSchemaStmtObjectAddress(Node *node, bool missing_ok)
|
|||
*/
|
||||
|
||||
/* typename is the last in the list of names */
|
||||
Value *typeNameStr = lfirst(list_tail(names));
|
||||
String *typeNameStr = lfirst(list_tail(names));
|
||||
|
||||
/*
|
||||
* we don't error here either, as the error would be not a good user facing
|
||||
|
|
|
@ -432,7 +432,7 @@ DeparseVacuumColumnNames(List *columnNameList)
|
|||
|
||||
appendStringInfoString(columnNames, " (");
|
||||
|
||||
Value *columnName = NULL;
|
||||
String *columnName = NULL;
|
||||
foreach_ptr(columnName, columnNameList)
|
||||
{
|
||||
appendStringInfo(columnNames, "%s,", strVal(columnName));
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "pg_version_compat.h"
|
||||
|
||||
#include "catalog/namespace.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/parsenodes.h"
|
||||
|
@ -44,6 +46,6 @@ AppendAlterDatabaseOwnerStmt(StringInfo buf, AlterOwnerStmt *stmt)
|
|||
|
||||
appendStringInfo(buf,
|
||||
"ALTER DATABASE %s OWNER TO %s;",
|
||||
quote_identifier(strVal((Value *) stmt->object)),
|
||||
quote_identifier(strVal((String *) stmt->object)),
|
||||
RoleSpecString(stmt->newowner, true));
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ AppendDropForeignServerStmt(StringInfo buf, DropStmt *stmt)
|
|||
static void
|
||||
AppendServerNames(StringInfo buf, DropStmt *stmt)
|
||||
{
|
||||
Value *serverValue = NULL;
|
||||
String *serverValue = NULL;
|
||||
foreach_ptr(serverValue, stmt->objects)
|
||||
{
|
||||
const char *serverString = quote_identifier(strVal(serverValue));
|
||||
|
|
|
@ -396,18 +396,18 @@ AppendVarSetValue(StringInfo buf, VariableSetStmt *setStmt)
|
|||
appendStringInfo(buf, " SET %s =", quote_identifier(setStmt->name));
|
||||
}
|
||||
|
||||
Value value = varArgConst->val;
|
||||
switch (value.type)
|
||||
Node *value = (Node *) &varArgConst->val;
|
||||
switch (value->type)
|
||||
{
|
||||
case T_Integer:
|
||||
{
|
||||
appendStringInfo(buf, " %d", intVal(&value));
|
||||
appendStringInfo(buf, " %d", intVal(value));
|
||||
break;
|
||||
}
|
||||
|
||||
case T_Float:
|
||||
{
|
||||
appendStringInfo(buf, " %s", strVal(&value));
|
||||
appendStringInfo(buf, " %s", strVal(value));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ AppendVarSetValue(StringInfo buf, VariableSetStmt *setStmt)
|
|||
|
||||
Datum interval =
|
||||
DirectFunctionCall3(interval_in,
|
||||
CStringGetDatum(strVal(&value)),
|
||||
CStringGetDatum(strVal(value)),
|
||||
ObjectIdGetDatum(InvalidOid),
|
||||
Int32GetDatum(typmod));
|
||||
|
||||
|
@ -440,7 +440,7 @@ AppendVarSetValue(StringInfo buf, VariableSetStmt *setStmt)
|
|||
else
|
||||
{
|
||||
appendStringInfo(buf, " %s", quote_literal_cstr(strVal(
|
||||
&value)));
|
||||
value)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ AppendDropSchemaStmt(StringInfo buf, DropStmt *stmt)
|
|||
appendStringInfoString(buf, "IF EXISTS ");
|
||||
}
|
||||
|
||||
Value *schemaValue = NULL;
|
||||
String *schemaValue = NULL;
|
||||
foreach_ptr(schemaValue, stmt->objects)
|
||||
{
|
||||
const char *schemaString = quote_identifier(strVal(schemaValue));
|
||||
|
|
|
@ -200,10 +200,10 @@ AppendAlterStatisticsOwnerStmt(StringInfo buf, AlterOwnerStmt *stmt)
|
|||
static void
|
||||
AppendStatisticsName(StringInfo buf, CreateStatsStmt *stmt)
|
||||
{
|
||||
Value *schemaNameVal = (Value *) linitial(stmt->defnames);
|
||||
String *schemaNameVal = (String *) linitial(stmt->defnames);
|
||||
const char *schemaName = quote_identifier(strVal(schemaNameVal));
|
||||
|
||||
Value *statNameVal = (Value *) lsecond(stmt->defnames);
|
||||
String *statNameVal = (String *) lsecond(stmt->defnames);
|
||||
const char *statName = quote_identifier(strVal(statNameVal));
|
||||
|
||||
appendStringInfo(buf, "%s.%s", schemaName, statName);
|
||||
|
@ -220,7 +220,7 @@ AppendStatTypes(StringInfo buf, CreateStatsStmt *stmt)
|
|||
|
||||
appendStringInfoString(buf, " (");
|
||||
|
||||
Value *statType = NULL;
|
||||
String *statType = NULL;
|
||||
foreach_ptr(statType, stmt->stat_types)
|
||||
{
|
||||
appendStringInfoString(buf, strVal(statType));
|
||||
|
|
|
@ -464,7 +464,7 @@ DeparseTextSearchDictionaryCommentStmt(Node *node)
|
|||
static void
|
||||
AppendStringInfoTokentypeList(StringInfo buf, List *tokentypes)
|
||||
{
|
||||
Value *tokentype = NULL;
|
||||
String *tokentype = NULL;
|
||||
bool first = true;
|
||||
foreach_ptr(tokentype, tokentypes)
|
||||
{
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "pg_version_compat.h"
|
||||
|
||||
#include "stdint.h"
|
||||
#include "postgres.h"
|
||||
|
@ -2864,8 +2866,8 @@ CurrentUserName(void)
|
|||
Oid
|
||||
LookupTypeOid(char *schemaNameSting, char *typeNameString)
|
||||
{
|
||||
Value *schemaName = makeString(schemaNameSting);
|
||||
Value *typeName = makeString(typeNameString);
|
||||
String *schemaName = makeString(schemaNameSting);
|
||||
String *typeName = makeString(typeNameString);
|
||||
List *qualifiedName = list_make2(schemaName, typeName);
|
||||
TypeName *enumTypeName = makeTypeNameFromNameList(qualifiedName);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
#include "pg_version_compat.h"
|
||||
#include "distributed/pg_version_constants.h"
|
||||
|
||||
#include "distributed/cte_inline.h"
|
||||
|
@ -309,7 +310,7 @@ inline_cte_walker(Node *node, inline_cte_walker_context *context)
|
|||
*/
|
||||
if (columnAliasCount >= columnIndex)
|
||||
{
|
||||
Value *columnAlias = (Value *) list_nth(columnAliasList, columnIndex - 1);
|
||||
String *columnAlias = (String *) list_nth(columnAliasList, columnIndex - 1);
|
||||
Assert(IsA(columnAlias, String));
|
||||
TargetEntry *targetEntry =
|
||||
list_nth(rte->subquery->targetList, columnIndex - 1);
|
||||
|
|
|
@ -1353,7 +1353,7 @@ FinalizeRouterPlan(PlannedStmt *localPlan, CustomScan *customScan)
|
|||
TargetEntry *targetEntry = NULL;
|
||||
foreach_ptr(targetEntry, customScan->scan.plan.targetlist)
|
||||
{
|
||||
Value *columnName = makeString(targetEntry->resname);
|
||||
String *columnName = makeString(targetEntry->resname);
|
||||
columnNameList = lappend(columnNameList, columnName);
|
||||
}
|
||||
|
||||
|
|
|
@ -798,7 +798,7 @@ DerivedColumnNameList(uint32 columnCount, uint64 generatingJobId)
|
|||
appendStringInfo(columnName, UINT64_FORMAT "_", generatingJobId);
|
||||
appendStringInfo(columnName, "%u", columnIndex);
|
||||
|
||||
Value *columnValue = makeString(columnName->data);
|
||||
String *columnValue = makeString(columnName->data);
|
||||
columnNameList = lappend(columnNameList, columnValue);
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ static Job * RouterJob(Query *originalQuery,
|
|||
static bool RelationPrunesToMultipleShards(List *relationShardList);
|
||||
static void NormalizeMultiRowInsertTargetList(Query *query);
|
||||
static void AppendNextDummyColReference(Alias *expendedReferenceNames);
|
||||
static Value * MakeDummyColumnString(int dummyColumnId);
|
||||
static String * MakeDummyColumnString(int dummyColumnId);
|
||||
static List * BuildRoutesForInsert(Query *query, DeferredErrorMessage **planningError);
|
||||
static List * GroupInsertValuesByShardId(List *insertValuesList);
|
||||
static List * ExtractInsertValuesList(Query *query, Var *partitionColumn);
|
||||
|
@ -3249,7 +3249,7 @@ AppendNextDummyColReference(Alias *expendedReferenceNames)
|
|||
{
|
||||
int existingColReferences = list_length(expendedReferenceNames->colnames);
|
||||
int nextColReferenceId = existingColReferences + 1;
|
||||
Value *missingColumnString = MakeDummyColumnString(nextColReferenceId);
|
||||
String *missingColumnString = MakeDummyColumnString(nextColReferenceId);
|
||||
expendedReferenceNames->colnames = lappend(expendedReferenceNames->colnames,
|
||||
missingColumnString);
|
||||
}
|
||||
|
@ -3259,12 +3259,12 @@ AppendNextDummyColReference(Alias *expendedReferenceNames)
|
|||
* MakeDummyColumnString returns a String (Value) object by appending given
|
||||
* integer to end of the "column" string.
|
||||
*/
|
||||
static Value *
|
||||
static String *
|
||||
MakeDummyColumnString(int dummyColumnId)
|
||||
{
|
||||
StringInfo dummyColumnStringInfo = makeStringInfo();
|
||||
appendStringInfo(dummyColumnStringInfo, "column%d", dummyColumnId);
|
||||
Value *dummyColumnString = makeString(dummyColumnStringInfo->data);
|
||||
String *dummyColumnString = makeString(dummyColumnStringInfo->data);
|
||||
|
||||
return dummyColumnString;
|
||||
}
|
||||
|
|
|
@ -1952,7 +1952,7 @@ BuildReadIntermediateResultsQuery(List *targetEntryList, List *columnAliasList,
|
|||
*/
|
||||
if (columnAliasCount >= columnNumber)
|
||||
{
|
||||
Value *columnAlias = (Value *) list_nth(columnAliasList, columnNumber - 1);
|
||||
String *columnAlias = (String *) list_nth(columnAliasList, columnNumber - 1);
|
||||
Assert(IsA(columnAlias, String));
|
||||
newTargetEntry->resname = strVal(columnAlias);
|
||||
}
|
||||
|
|
|
@ -326,8 +326,8 @@ RelayEventExtendNames(Node *parseTree, char *schemaName, uint64 shardId)
|
|||
if (objectType == OBJECT_TABLE || objectType == OBJECT_INDEX ||
|
||||
objectType == OBJECT_FOREIGN_TABLE || objectType == OBJECT_FOREIGN_SERVER)
|
||||
{
|
||||
Value *relationSchemaNameValue = NULL;
|
||||
Value *relationNameValue = NULL;
|
||||
String *relationSchemaNameValue = NULL;
|
||||
String *relationNameValue = NULL;
|
||||
|
||||
uint32 dropCount = list_length(dropStmt->objects);
|
||||
if (dropCount > 1)
|
||||
|
@ -381,11 +381,11 @@ RelayEventExtendNames(Node *parseTree, char *schemaName, uint64 shardId)
|
|||
/* prefix with schema name if it is not added already */
|
||||
if (relationSchemaNameValue == NULL)
|
||||
{
|
||||
Value *schemaNameValue = makeString(pstrdup(schemaName));
|
||||
String *schemaNameValue = makeString(pstrdup(schemaName));
|
||||
relationNameList = lcons(schemaNameValue, relationNameList);
|
||||
}
|
||||
|
||||
char **relationName = &(relationNameValue->val.str);
|
||||
char **relationName = &(strVal(relationNameValue));
|
||||
AppendShardIdToName(relationName, shardId);
|
||||
}
|
||||
else if (objectType == OBJECT_POLICY)
|
||||
|
@ -750,10 +750,10 @@ UpdateWholeRowColumnReferencesWalker(Node *node, uint64 *shardId)
|
|||
* extend the penultimate element with the shardId.
|
||||
*/
|
||||
int colrefFieldCount = list_length(columnRef->fields);
|
||||
Value *relnameValue = list_nth(columnRef->fields, colrefFieldCount - 2);
|
||||
String *relnameValue = list_nth(columnRef->fields, colrefFieldCount - 2);
|
||||
Assert(IsA(relnameValue, String));
|
||||
|
||||
AppendShardIdToName(&relnameValue->val.str, *shardId);
|
||||
AppendShardIdToName(&strVal(relnameValue), *shardId);
|
||||
}
|
||||
|
||||
/* might be more than one ColumnRef to visit */
|
||||
|
|
|
@ -37,6 +37,29 @@ wake_up_connection_pool_waiters(PG_FUNCTION_ARGS)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* makeIntConst creates a Const Node that stores a given integer
|
||||
*
|
||||
* copied from backend/parser/gram.c
|
||||
*/
|
||||
static Node *
|
||||
makeIntConst(int val, int location)
|
||||
{
|
||||
A_Const *n = makeNode(A_Const);
|
||||
|
||||
#if PG_VERSION_NUM >= PG_VERSION_15
|
||||
n->val.ival.type = T_Integer;
|
||||
n->val.ival.ival = val;
|
||||
#else
|
||||
n->val.type = T_Integer;
|
||||
n->val.val.ival = val;
|
||||
#endif
|
||||
n->location = location;
|
||||
|
||||
return (Node *) n;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* set_max_shared_pool_size is a SQL
|
||||
* interface for setting MaxSharedPoolSize. We use this function in isolation
|
||||
|
@ -49,9 +72,8 @@ set_max_shared_pool_size(PG_FUNCTION_ARGS)
|
|||
|
||||
AlterSystemStmt *alterSystemStmt = palloc0(sizeof(AlterSystemStmt));
|
||||
|
||||
A_Const *aConstValue = makeNode(A_Const);
|
||||
A_Const *aConstValue = castNode(A_Const, makeIntConst(value, 0));
|
||||
|
||||
aConstValue->val = *makeInteger(value);
|
||||
alterSystemStmt->setstmt = makeNode(VariableSetStmt);
|
||||
alterSystemStmt->setstmt->name = "citus.max_shared_pool_size";
|
||||
alterSystemStmt->setstmt->is_local = false;
|
||||
|
|
|
@ -18,10 +18,12 @@
|
|||
#define RelationCreateStorage_compat(a, b, c) RelationCreateStorage(a, b, c)
|
||||
#else
|
||||
|
||||
#include "nodes/value.h"
|
||||
#include "storage/smgr.h"
|
||||
#include "utils/int8.h"
|
||||
#include "utils/rel.h"
|
||||
|
||||
typedef Value String;
|
||||
|
||||
#ifdef HAVE_LONG_INT_64
|
||||
#define strtoi64(str, endptr, base) ((int64) strtol(str, endptr, base))
|
||||
|
|
Loading…
Reference in New Issue