ERROR: COALESCE types text and bigint cannot be matched

5,115 views
Skip to first unread message

Cássio Marques

unread,
Apr 15, 2010, 3:28:51 PM4/15/10
to thinkin...@googlegroups.com
Hello all,

I'm trying to index a model in a new application but using a legacy database. My index definition is pretty simple:

class Donor < ActiveRecord::Base
  define_index do
    indexes name, :sortable => true
  end
end

And I'm getting the following error:

indexing index 'donor_core'...
ERROR: index 'donor_core': sql_query_range: : range-query failed: ERROR:  COALESCE types text and bigint cannot be matched
LINE 1: SELECT COALESCE(MIN("id"), 1::bigint), COALESCE(MAX("id"), 1...
                                   ^
 (DSN=pgsql://cmarques:***@localhost:5432/csh-web_development).

The name column in the donors table is a varchar(255). What is this bigint/text thing all about?

I really don't know what's wrong here. Anyone?

Thank you very much!

--  
Cássio Marques

Blog: http://cassiomarques.wordpress.com

If you're writing code and you're not testing it, the code is wrong. I don't care if it does the right thing, and people need to understand this. If it works by accident, you're still wrong.
Bryan Liles - Ruby Hoedown 2008

Cássio Marques

unread,
Apr 22, 2010, 7:40:34 AM4/22/10
to thinkin...@googlegroups.com
Sorry about posting here again... but does anyone have some ideas about this problem? 

thank you!

2010/4/15 Cássio Marques <cass...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
To post to this group, send email to thinkin...@googlegroups.com.
To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.

Cássio Marques

unread,
Apr 22, 2010, 5:04:24 PM4/22/10
to thinkin...@googlegroups.com
Ok, I've solved this. The problem was that my PK was varchar and not integer (it's a legacy database). I've managed to change it to integer and now everything is working. Thanks! 

2010/4/22 Cássio Marques <cass...@gmail.com>

Pat Allan

unread,
Apr 22, 2010, 10:28:51 PM4/22/10
to thinkin...@googlegroups.com
Hi Cássio

Sorry I didn't get to your email sooner, but it's good to know you've got a solution figured out. Hopefully the rest all goes smoothly!

Cheers

--
Pat

Cássio Marques

unread,
Apr 22, 2010, 10:31:01 PM4/22/10
to thinkin...@googlegroups.com
Thanks Pat!
Reply all
Reply to author
Forward
0 new messages