Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9253723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:17:27+00:00 2026-06-18T11:17:27+00:00

I set up my Rails 3.2.x app to use PostgreSQL HStore but I’m getting

  • 0

I set up my Rails 3.2.x app to use PostgreSQL HStore but I’m getting an error.
It looks like the hstore extension hasn’t been picked up by the environment.
I already rebooted my machine, checked database extensions, etc.

When I try to execute:

User.where("settings @> (:key => :value)", :key => "setting_x", :value => "test")

I get an error: (@> is not recognized, i.e., extension hstore is not installed?)

HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

My Rails application setup is:

Gemfile.rb:

gem 'activerecord-postgres-hstore'

Migration:

add_column :users, :settings, :hstore
execute "CREATE INDEX CONCURRENTLY users_gin_settings ON users USING GIN(settings)"
# can see the extenstion installed on my local dev psql database after this

User model:

serialize :settings, ActiveRecord::Coders::Hstore

Dynamic User methods:

# metaprogramming: has_setting_x + instance.setting_x
%w[setting_x setting_y setting_z].each do |key|
attr_accessible key
    # doesn't work > throws error because of the @> operator
    scope "has_#{key}", lambda { |value| where("settings @> (? => ?)", key, value) }

    # works: can use instance.setting_x
    define_method(key) do
      settings && settings[key]
    end

    # works: can use instance.setting_x = "value"
    define_method("#{key}=") do |value|
      self.settings = (settings || {}).merge(key => value)
    end
end

Update 1:

This works when I talk directly to the PostgreSQL DB:

SELECT "users".* FROM "users" WHERE (settings @> hstore('setting_x','6D9Q7RO4SVWHXK86F'));

The Hstore docs say:

The => operator is deprecated and may be removed in a future release. Use the hstore(text, text) function instead.

So, from the look of it, my PostgreSQL database version (9.2.1) has already deprecated the => notation. It looks like I have more research ahead.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:17:28+00:00Added an answer on June 18, 2026 at 11:17 am

    From the PostgreSQL docs:

    The => operator is deprecated and may be removed in a future release. Use the hstore(text, text) function instead.

    So from the look of it, my PG database version ( 9.2.1 ) has already deprecated the => notation.
    Working now both locally and on Heroku.

    Example:

    User.where("settings @> hstore(?,?)", "setting_x", key)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to set up a staging server for a Rails app. I use
I have a rails app, where Im having a drop box like feature-set. Each
I'm trying to use omniauth-twitter in a rails app, but i'm stuck at the
So I'm building a Rails app and I was making use of the Set
Im trying to use rails with postgresql and I set everything up properly with
I have a rails app set up as an OAuth2 provider (using Doorkeeper). The
My rails app is set up using a mysql database. When I do a
I have a Rails app running Mongoid on Heroku and I need to set
In my rails app I have user, school, and course models. I have set
I have my rails app, which is filled with products, set up with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.