#23167·cloudquery

cli/cmd/sync_v2.go: WithRemovePKs() called twice instead of WithRemovePKs() + WithRemoveUniqueConstraints()

Author: praneshnikharCreated Jul 27, 2026Updated Jul 27, 2026

CLI: Wrong transformer option in cli/cmd/sync_v2.go

File: cli/cmd/sync_v2.go:34

Problem: In the v2→v3 append-mode path, WithRemovePKs() is called twice instead of WithRemovePKs() + WithRemoveUniqueConstraints(). This means unique constraints are silently preserved when they should be removed to match v3's schema expectations.

Current code:

go
opts = append(opts, transformer.WithRemovePKs(), transformer.WithRemovePKs())

Expected:

go
opts = append(opts, transformer.WithRemovePKs())
opts = append(opts, transformer.WithRemoveUniqueConstraints())

Fix: Replace the duplicate WithRemovePKs() call with WithRemoveUniqueConstraints().

Reproduction

  1. Configure a v2 source plugin with a v3 destination in append mode (via v2-to-v3 migration path).
  2. Run sync — unique constraints from v2 tables are preserved in the destination.
  3. These constraints can cause conflicts/errors on subsequent writes since v3 destinations don't expect them.