Use bigserial instead of BIGINT in sequence error

pull/1163/head
Marco Slot 2017-01-23 16:49:25 +01:00
parent 9f9fc09320
commit 72725ba30c
2 changed files with 8 additions and 5 deletions

View File

@ -875,7 +875,7 @@ CreateSchemaDDLCommand(Oid schemaId)
* manner. * manner.
* *
* Any column which depends on a sequence (and will therefore be replicated) but which is * Any column which depends on a sequence (and will therefore be replicated) but which is
* not a BIGINT cannot be used for an mx table, because there aren't enough values to * not a bigserial cannot be used for an mx table, because there aren't enough values to
* ensure that generated numbers are globally unique. * ensure that generated numbers are globally unique.
*/ */
static void static void
@ -897,8 +897,9 @@ EnsureSupportedSequenceColumnType(Oid sequenceOid)
if (columnType != INT8OID && shouldSyncMetadata && hasMetadataWorkers) if (columnType != INT8OID && shouldSyncMetadata && hasMetadataWorkers)
{ {
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot create an mx table with columns which use " errmsg("cannot create an mx table with a serial or smallserial "
"sequences, but are not BIGINT"))); "column "),
errdetail("Only bigserial is supported in mx tables.")));
} }
} }

View File

@ -909,7 +909,8 @@ SELECT create_distributed_table('mx_table_with_small_sequence', 'a');
(1 row) (1 row)
SELECT start_metadata_sync_to_node('localhost', :worker_1_port); SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
ERROR: cannot create an mx table with columns which use sequences, but are not BIGINT ERROR: cannot create an mx table with a serial or smallserial column
DETAIL: Only bigserial is supported in mx tables.
DROP TABLE mx_table_with_small_sequence; DROP TABLE mx_table_with_small_sequence;
SELECT start_metadata_sync_to_node('localhost', :worker_1_port); SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
start_metadata_sync_to_node start_metadata_sync_to_node
@ -921,7 +922,8 @@ SELECT start_metadata_sync_to_node('localhost', :worker_1_port);
-- there are metadata workers -- there are metadata workers
CREATE TABLE mx_table_with_small_sequence(a int, b SERIAL); CREATE TABLE mx_table_with_small_sequence(a int, b SERIAL);
SELECT create_distributed_table('mx_table_with_small_sequence', 'a'); SELECT create_distributed_table('mx_table_with_small_sequence', 'a');
ERROR: cannot create an mx table with columns which use sequences, but are not BIGINT ERROR: cannot create an mx table with a serial or smallserial column
DETAIL: Only bigserial is supported in mx tables.
DROP TABLE mx_table_with_small_sequence; DROP TABLE mx_table_with_small_sequence;
-- Create an MX table with (BIGSERIAL) sequences -- Create an MX table with (BIGSERIAL) sequences
CREATE TABLE mx_table_with_sequence(a int, b BIGSERIAL, c BIGSERIAL); CREATE TABLE mx_table_with_sequence(a int, b BIGSERIAL, c BIGSERIAL);