mirror of https://github.com/citusdata/citus.git
move MakeNameListFromRangeVar function to a more appropriate file
parent
2396b66ac5
commit
52fd58d51f
|
@ -1503,3 +1503,32 @@ AlterTableSchemaStmtObjectAddress(Node *node, bool missing_ok)
|
|||
|
||||
return address;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* MakeNameListFromRangeVar makes a namelist from a RangeVar. Its behaviour
|
||||
* should be the exact opposite of postgres' makeRangeVarFromNameList.
|
||||
*/
|
||||
List *
|
||||
MakeNameListFromRangeVar(const RangeVar *rel)
|
||||
{
|
||||
if (rel->catalogname != NULL)
|
||||
{
|
||||
Assert(rel->schemaname != NULL);
|
||||
Assert(rel->relname != NULL);
|
||||
return list_make3(makeString(rel->catalogname),
|
||||
makeString(rel->schemaname),
|
||||
makeString(rel->relname));
|
||||
}
|
||||
else if (rel->schemaname != NULL)
|
||||
{
|
||||
Assert(rel->relname != NULL);
|
||||
return list_make2(makeString(rel->schemaname),
|
||||
makeString(rel->relname));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert(rel->relname != NULL);
|
||||
return list_make1(makeString(rel->relname));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
#include "distributed/deparser.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata/distobject.h"
|
||||
#include "distributed/metadata/namespace.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/multi_executor.h"
|
||||
#include "distributed/relation_access_tracking.h"
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/metadata/namespace.h"
|
||||
|
||||
#define AlterEnumIsRename(stmt) (stmt->oldVal != NULL)
|
||||
#define AlterEnumIsAddValue(stmt) (stmt->oldVal == NULL)
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
#include "catalog/namespace.h"
|
||||
#include "catalog/objectaddress.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/deparser.h"
|
||||
#include "distributed/metadata/namespace.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "parser/parse_type.h"
|
||||
#include "utils/syscache.h"
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "nodes/primnodes.h"
|
||||
#include "nodes/value.h"
|
||||
|
||||
#include "distributed/metadata/namespace.h"
|
||||
|
||||
/*
|
||||
* MakeNameListFromRangeVar makes a namelist from a RangeVar. Its behaviour should be the
|
||||
* exact opposite of postgres' makeRangeVarFromNameList.
|
||||
*/
|
||||
List *
|
||||
MakeNameListFromRangeVar(const RangeVar *rel)
|
||||
{
|
||||
if (rel->catalogname != NULL)
|
||||
{
|
||||
Assert(rel->schemaname != NULL);
|
||||
Assert(rel->relname != NULL);
|
||||
return list_make3(makeString(rel->catalogname),
|
||||
makeString(rel->schemaname),
|
||||
makeString(rel->relname));
|
||||
}
|
||||
else if (rel->schemaname != NULL)
|
||||
{
|
||||
Assert(rel->relname != NULL);
|
||||
return list_make2(makeString(rel->schemaname),
|
||||
makeString(rel->relname));
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert(rel->relname != NULL);
|
||||
return list_make1(makeString(rel->relname));
|
||||
}
|
||||
}
|
|
@ -226,6 +226,7 @@ extern void ErrorIfUnsupportedConstraint(Relation relation, char distributionMet
|
|||
Var *distributionColumn, uint32 colocationId);
|
||||
extern ObjectAddress AlterTableSchemaStmtObjectAddress(Node *stmt,
|
||||
bool missing_ok);
|
||||
extern List * MakeNameListFromRangeVar(const RangeVar *rel);
|
||||
|
||||
|
||||
/* truncate.c - forward declarations */
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* namespace.h
|
||||
* Helper functions for citus to work with postgres namespaces/schemas
|
||||
*
|
||||
* Copyright (c) Citus Data, Inc.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef CITUS_NAMESPACE_H
|
||||
#define CITUS_NAMESPACE_H
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "nodes/primnodes.h"
|
||||
|
||||
extern List * MakeNameListFromRangeVar(const RangeVar *rel);
|
||||
|
||||
#endif /*CITUS_NAMESPACE_H */
|
Loading…
Reference in New Issue