diff --git a/src/backend/distributed/operations/shard_cleaner.c b/src/backend/distributed/operations/shard_cleaner.c index d98b30c17..2d8b6c476 100644 --- a/src/backend/distributed/operations/shard_cleaner.c +++ b/src/backend/distributed/operations/shard_cleaner.c @@ -514,19 +514,16 @@ InsertCleanupRecordInSubtransaction(CleanupObject objectType, */ Assert(CurrentOperationId != INVALID_OPERATION_ID); - StringInfo sequenceName = makeStringInfo(); - appendStringInfo(sequenceName, "%s.%s", - PG_CATALOG, - CLEANUPRECORDID_SEQUENCE_NAME); + uint64 recordId = GetNextCleanupRecordId(); StringInfo command = makeStringInfo(); appendStringInfo(command, "INSERT INTO %s.%s " " (record_id, operation_id, object_type, object_name, node_group_id, policy_type) " - " VALUES ( nextval('%s'), " UINT64_FORMAT ", %d, %s, %d, %d)", + " VALUES ( %lu, " UINT64_FORMAT ", %d, %s, %d, %d)", PG_CATALOG, PG_DIST_CLEANUP, - sequenceName->data, + recordId, CurrentOperationId, objectType, quote_literal_cstr(objectName), diff --git a/src/test/regress/expected/citus_split_shard_by_split_points_deferred_drop.out b/src/test/regress/expected/citus_split_shard_by_split_points_deferred_drop.out index fc66118ca..cb76196ca 100644 --- a/src/test/regress/expected/citus_split_shard_by_split_points_deferred_drop.out +++ b/src/test/regress/expected/citus_split_shard_by_split_points_deferred_drop.out @@ -67,7 +67,7 @@ SELECT pg_catalog.citus_split_shard_by_split_points( SELECT * from pg_dist_cleanup; record_id | operation_id | object_type | object_name | node_group_id | policy_type --------------------------------------------------------------------- - 512 | 778 | 1 | citus_split_shard_by_split_points_deferred_schema.table_to_split_8981001 | 16 | 2 + 526 | 778 | 1 | citus_split_shard_by_split_points_deferred_schema.table_to_split_8981001 | 16 | 2 (1 row) -- One of the physical shards should not be deleted, the other one should.