ankane/pgsync · error · Error

Sync failed for #{failed_tables.size} table#{failed_tables.s

Error message

Sync failed for #{failed_tables.size} table#{failed_tables.size == 1 ? nil : "s"}: #{failed_tables.join(", ")}

What it means

Error "Sync failed for #{failed_tables.size} table#{failed_tables.size == 1 ? nil : "s"}: #{failed_tables.join(", ")}" thrown in ankane/pgsync.

Source

Thrown at lib/pgsync/table_sync.rb:310

          # we only update NOT DEFERRABLE
          # https://www.postgresql.org/docs/current/sql-set-constraints.html
          if opts[:defer_constraints_v2]
            destination.execute("SET CONSTRAINTS ALL IMMEDIATE")

            table_constraints.each do |table, constraints|
              constraints.each do |constraint|
                destination.execute("ALTER TABLE #{quote_ident_full(table)} ALTER CONSTRAINT #{quote_ident(constraint)} NOT DEFERRABLE")
              end
            end
          end
        end
      else
        yield
      end
    end

    def fail_sync(failed_tables)
      raise Error, "Sync failed for #{failed_tables.size} table#{failed_tables.size == 1 ? nil : "s"}: #{failed_tables.join(", ")}"
    end

    def display_item(item)
      messages = []
      messages << task_name(item)
      messages << item.opts[:sql] if item.opts[:sql]
      messages.join(" ")
    end

    def windows?
      Gem.win_platform?
    end
  end
end

View on GitHub (pinned to 57bdddf5db)

When it happens

Trigger: Thrown at lib/pgsync/table_sync.rb:310 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/18f2f241e13d9f0b. Report an issue: GitHub.