mirror of https://github.com/citusdata/citus.git
disallow creating distributed tables when the table has WITH (OIDS) set, as per @jasonmp85.
parent
3b024cac34
commit
2b5bd38153
|
@ -50,6 +50,7 @@ static void RecordDistributedRelationDependencies(Oid distributedRelationId,
|
|||
static Oid SupportFunctionForColumn(Var *partitionColumn, Oid accessMethodId,
|
||||
int16 supportFunctionNumber);
|
||||
static bool LocalTableEmpty(Oid tableId);
|
||||
static void ErrorIfTableHasOids(Relation relation);
|
||||
|
||||
|
||||
/* exports for SQL callable functions */
|
||||
|
@ -101,6 +102,7 @@ master_create_distributed_table(PG_FUNCTION_ARGS)
|
|||
distributedRelationName = RelationGetRelationName(distributedRelation);
|
||||
|
||||
EnsureTableOwner(distributedRelationId);
|
||||
ErrorIfTableHasOids(distributedRelation);
|
||||
|
||||
/* open system catalog and insert new tuple */
|
||||
pgDistPartition = heap_open(DistPartitionRelationId(), RowExclusiveLock);
|
||||
|
@ -446,3 +448,18 @@ LocalTableEmpty(Oid tableId)
|
|||
|
||||
return localTableEmpty;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ErrorIfTableHasOids raises an ERROR if a to-be-distributed table
|
||||
* has the WITH (OIDS) option set.
|
||||
*/
|
||||
static void
|
||||
ErrorIfTableHasOids(Relation relation)
|
||||
{
|
||||
if (relation->rd_att->tdhasoid)
|
||||
{
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("WITH (OIDS) not supported on distributed tables")));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,12 @@ CREATE TABLE table_to_distribute (
|
|||
json_data json,
|
||||
test_type_data dummy_type
|
||||
);
|
||||
-- use the table WITH (OIDS) set
|
||||
ALTER TABLE table_to_distribute SET WITH OIDS;
|
||||
SELECT master_create_distributed_table('table_to_distribute', 'id', 'hash');
|
||||
ERROR: WITH (OIDS) not supported on distributed tables
|
||||
-- revert WITH (OIDS) from above
|
||||
ALTER TABLE table_to_distribute SET WITHOUT OIDS;
|
||||
-- use an index instead of table name
|
||||
SELECT master_create_distributed_table('table_to_distribute_pkey', 'id', 'hash');
|
||||
ERROR: cannot distribute relation: table_to_distribute_pkey
|
||||
|
|
|
@ -52,6 +52,13 @@ CREATE TABLE table_to_distribute (
|
|||
test_type_data dummy_type
|
||||
);
|
||||
|
||||
-- use the table WITH (OIDS) set
|
||||
ALTER TABLE table_to_distribute SET WITH OIDS;
|
||||
SELECT master_create_distributed_table('table_to_distribute', 'id', 'hash');
|
||||
|
||||
-- revert WITH (OIDS) from above
|
||||
ALTER TABLE table_to_distribute SET WITHOUT OIDS;
|
||||
|
||||
-- use an index instead of table name
|
||||
SELECT master_create_distributed_table('table_to_distribute_pkey', 'id', 'hash');
|
||||
|
||||
|
|
Loading…
Reference in New Issue