ankane/pgsync · error · Error

This should never happen. Please file a bug.

Error message

This should never happen. Please file a bug.

What it means

Error "This should never happen. Please file a bug." thrown in ankane/pgsync.

Source

Thrown at lib/pgsync/task.rb:79

        missing_sequences = from_sequences - to_sequences
        notes << "Missing sequences: #{missing_sequences.join(", ")}" if missing_sequences.any?

        from_types = from_columns.map { |c| [c[:name], c[:type]] }.to_h
        to_types = to_columns.map { |c| [c[:name], c[:type]] }.to_h
        different_types = []
        shared_fields.each do |field|
          if from_types[field] != to_types[field]
            different_types << "#{field} (#{from_types[field]} -> #{to_types[field]})"
          end
        end
        notes << "Different column types: #{different_types.join(", ")}" if different_types.any?
      end
      notes
    end

    def sync_data
      raise Error, "This should never happen. Please file a bug." if shared_fields.empty?

      sql_clause = String.new("")
      sql_clause << " #{opts[:sql]}" if opts[:sql]

      bad_fields = opts[:no_rules] ? [] : config["data_rules"]
      primary_key = to_primary_key
      copy_fields = shared_fields.map { |f| f2 = bad_fields.to_a.find { |bf, _| rule_match?(table, f, bf) }; f2 ? "#{apply_strategy(f2[1], table, f, primary_key)} AS #{quote_ident(f)}" : "#{quoted_table}.#{quote_ident(f)}" }.join(", ")
      fields = shared_fields.map { |f| quote_ident(f) }.join(", ")

      copy_to_command = "COPY (SELECT #{copy_fields} FROM #{quoted_table}#{sql_clause}) TO STDOUT"
      if opts[:in_batches]
        raise Error, "Primary key required for --in-batches" if primary_key.empty?
        primary_key = primary_key.first

        destination.truncate(table) if opts[:truncate]

        from_max_id = source.max_id(table, primary_key)
        to_max_id = destination.max_id(table, primary_key) + 1

View on GitHub (pinned to 57bdddf5db)

When it happens

Trigger: Thrown at lib/pgsync/task.rb:79 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/e314496ae7c49211. Report an issue: GitHub.