ankane/pgsync · error · Error

Invalid connection string. Make sure it works with `psql`

Error message

Invalid connection string. Make sure it works with `psql`

What it means

Error "Invalid connection string. Make sure it works with `psql`" thrown in ankane/pgsync.

Source

Thrown at lib/pgsync/data_source.rb:120

        WHERE
          pg_trigger.tgrelid = $1::regclass
      SQL
      execute(query, [quote_ident_full(table)])
    end

    def conn
      @conn ||= begin
        begin
          ENV["PGCONNECT_TIMEOUT"] ||= "3"
          if @url.start_with?("postgres://", "postgresql://")
            config = @url
          else
            config = {dbname: @url}
          end
          @concurrent_id = concurrent_id
          PG::Connection.new(config)
        rescue URI::InvalidURIError
          raise Error, "Invalid connection string. Make sure it works with `psql`"
        end
      end
    end

    def close
      if @conn
        @conn.close
        @conn = nil
      end
    end

    # reconnect for new thread or process
    def reconnect_if_needed
      reconnect if @concurrent_id != concurrent_id
    end

    def search_path
      @search_path ||= execute("SELECT unnest(current_schemas(true)) AS schema").map { |r| r["schema"] }

View on GitHub (pinned to 57bdddf5db)

When it happens

Trigger: Thrown at lib/pgsync/data_source.rb:120 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/78e84e294a7035c2. Report an issue: GitHub.