ankane/pgsync · error · Error

Cannot use --in-batches with multiple tables

Error message

Cannot use --in-batches with multiple tables

What it means

Error "Cannot use --in-batches with multiple tables" thrown in ankane/pgsync.

Source

Thrown at lib/pgsync/sync.rb:51

      unless opts[:to_safe] || destination.local?
        raise Error, "Danger! Add `to_safe: true` to `.pgsync.yml` if the destination is not localhost or 127.0.0.1"
      end

      print_description("From", source)
      print_description("To", destination)

      if (opts[:preserve] || opts[:overwrite]) && destination.server_version_num < 90500
        raise Error, "Postgres 9.5+ is required for --preserve and --overwrite"
      end

      resolver = TaskResolver.new(args: args, opts: opts, source: source, destination: destination, config: config, first_schema: first_schema)
      tasks =
        resolver.tasks.map do |task|
          Task.new(source: source, destination: destination, config: config, table: task[:table], opts: opts.merge(sql: task[:sql]))
        end

      if opts[:in_batches] && tasks.size > 1
        raise Error, "Cannot use --in-batches with multiple tables"
      end

      confirm_tables_exist(source, tasks, "source")

      if opts[:list]
        confirm_tables_exist(destination, tasks, "destination")
        tasks.each do |task|
          log task_name(task)
        end
      else
        if opts[:schema_first] || opts[:schema_only]
          SchemaSync.new(source: source, destination: destination, tasks: tasks, args: args, opts: opts).perform
        end

        unless opts[:schema_only]
          TableSync.new(source: source, destination: destination, tasks: tasks, opts: opts, resolver: resolver).perform
        end

View on GitHub (pinned to 57bdddf5db)

When it happens

Trigger: Thrown at lib/pgsync/sync.rb:51 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ankane/pgsync@57bdddf5db (2026-08-23). Data as JSON: /api/errors/d131252b4f878270. Report an issue: GitHub.