Skip to content


Fixes #6073, #6383 - Postgres added tsvector type, and fixed money_precision= NoMethodError #197

wants to merge 2 commits into from

9 participants


This fixes a couple of issues that I have encountered while using postgres tesearch functionality:

#6073 - Patch by Robert Sosinski ( adding the tsvector data type

#6382 - Patch to fix money_precision= setting the variable in the wrong class


Any chance we could get a test for this?


I've written some simple tests to support the PostgreSQL tsvector data type patch for #6073.

Writing these tests has raised some questions. Whilst we can now schema dump without fear, is the data type useful on it's own? I can't think of a case where I would use the tsvector type without a trigger and of course that is not something that is presently supported in the schema DSL (or perhaps I've missed something?).

Tests are here, on the tsvector_tests_6073 branch:


I have read the Rails submission guidelines and have now created a patch and attached it to Lighthouse ticket #6073:


@tenderlove can I get your feedback on his test here? scottlowe@395902b

If you said yes, I think we can merge this pull request and then cherry-pick that commit.

@tenderlove tenderlove was assigned

I would be more than happy to write additional tests or amend what is there, if there is an appetite for it.


@scottlowe no, this is good. I'll merge it in.


Was this ever merged in? @tenderlove


the tsvector support got merged with this pull request #310


Recommend this ticket be closed, no further action is appears to be required.

@tenderlove tenderlove closed this

Could someone pull this in to 3-0-stable as it is getting tiresome hand patching it in every time I deploy a 3.0 based app.


Agreed, please, merge in rails 3 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
8 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -111,6 +111,9 @@ def simplified_type(field_type)
# UUID type
when 'uuid'
+ # TSVector type
+ when 'tsvector'
+ :tsvector
# Small and big integer types
when /^(?:small|big)int$/
@@ -207,7 +210,8 @@ class PostgreSQLAdapter < AbstractAdapter
:date => { :name => "date" },
:binary => { :name => "bytea" },
:boolean => { :name => "boolean" },
- :xml => { :name => "xml" }
+ :xml => { :name => "xml" },
+ :tsvector => { :name => "tsvector" }
# Returns 'PostgreSQL' as adapter name for identification purposes.
@@ -935,7 +939,7 @@ def connect
# Money type has a fixed precision of 10 in PostgreSQL 8.2 and below, and as of
# PostgreSQL 8.3 it has a fixed precision of 19. PostgreSQLColumn.extract_precision
# should know about this but can't detect it there, so deal with it here.
- PostgreSQLColumn.money_precision = (postgresql_version >= 80300) ? 19 : 10
+ ActiveRecord::ConnectionAdapters::PostgreSQLColumn.money_precision = (postgresql_version >= 80300) ? 19 : 10
Something went wrong with that request. Please try again.