mirror of https://github.com/citusdata/citus.git
Ensure we are allowing partitioned tables at all appropriate places
parent
2eee556738
commit
8455d1a4ef
|
@ -27,6 +27,7 @@
|
|||
#if (PG_VERSION_NUM >= 100000)
|
||||
#include "catalog/partition.h"
|
||||
#endif
|
||||
#include "distributed/citus_ruleutils.h"
|
||||
#include "distributed/colocation_utils.h"
|
||||
#include "distributed/connection_management.h"
|
||||
#include "distributed/multi_client_executor.h"
|
||||
|
@ -344,11 +345,7 @@ CheckDistributedTable(Oid relationId)
|
|||
char *relationName = get_rel_name(relationId);
|
||||
|
||||
/* check that the relationId belongs to a table */
|
||||
char tableType = get_rel_relkind(relationId);
|
||||
if (!(tableType == RELKIND_RELATION || tableType == RELKIND_FOREIGN_TABLE))
|
||||
{
|
||||
ereport(ERROR, (errmsg("relation \"%s\" is not a table", relationName)));
|
||||
}
|
||||
EnsureRelationKindSupported(relationId);
|
||||
|
||||
if (!IsDistributedTable(relationId))
|
||||
{
|
||||
|
|
|
@ -307,12 +307,7 @@ pg_get_tableschemadef_string(Oid tableRelationId, bool includeSequenceDefaults)
|
|||
|
||||
initStringInfo(&buffer);
|
||||
|
||||
relationKind = relation->rd_rel->relkind;
|
||||
#if (PG_VERSION_NUM >= 100000)
|
||||
if (relationKind == RELKIND_RELATION || relationKind == RELKIND_PARTITIONED_TABLE)
|
||||
#else
|
||||
if (relationKind == RELKIND_RELATION)
|
||||
#endif
|
||||
if (RegularTable(tableRelationId))
|
||||
{
|
||||
appendStringInfoString(&buffer, "CREATE ");
|
||||
|
||||
|
@ -461,6 +456,7 @@ pg_get_tableschemadef_string(Oid tableRelationId, bool includeSequenceDefaults)
|
|||
* If the relation is a foreign table, append the server name and options to
|
||||
* the create table statement.
|
||||
*/
|
||||
relationKind = relation->rd_rel->relkind;
|
||||
if (relationKind == RELKIND_FOREIGN_TABLE)
|
||||
{
|
||||
ForeignTable *foreignTable = GetForeignTable(tableRelationId);
|
||||
|
|
|
@ -690,7 +690,7 @@ LocalTableSize(Oid relationId)
|
|||
Datum relationIdDatum = ObjectIdGetDatum(relationId);
|
||||
|
||||
relationType = get_rel_relkind(relationId);
|
||||
if (relationType == RELKIND_RELATION)
|
||||
if (RegularTable(relationId))
|
||||
{
|
||||
Datum tableSizeDatum = DirectFunctionCall1(pg_table_size, relationIdDatum);
|
||||
|
||||
|
|
|
@ -62,12 +62,7 @@ worker_drop_distributed_table(PG_FUNCTION_ARGS)
|
|||
/* first check the relation type */
|
||||
distributedRelation = relation_open(relationId, AccessShareLock);
|
||||
relationKind = distributedRelation->rd_rel->relkind;
|
||||
if (relationKind != RELKIND_RELATION && relationKind != RELKIND_FOREIGN_TABLE)
|
||||
{
|
||||
char *relationName = generate_relation_name(relationId, NIL);
|
||||
ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("%s is not a regular or foreign table", relationName)));
|
||||
}
|
||||
EnsureRelationKindSupported(relationId);
|
||||
|
||||
/* close the relation since we do not need anymore */
|
||||
relation_close(distributedRelation, AccessShareLock);
|
||||
|
|
Loading…
Reference in New Issue