Tagged Questions
49
votes
9answers
29k views
How to handle Ruby on Rails error: “Please install the postgresql adapter: `gem install activerecord-postgresql-adapter'”
Running a Ruby on Rails (RoR) app or Ruby code which uses the ActiveRecord framework, you get the error message:
Please install the postgresql adapter:
gem install
...
24
votes
12answers
22k views
gem install pg doesn't work on OSX Lion
There are variations of this question bouncing around SO, but none of them seem to have an answer that solves my problem.
I am running OSX Lion (10.7.3). The latest XCode is installed.
I've ...
23
votes
3answers
6k views
gem install pg can not bind to libpq
After upgrading to Ruby 1.9.3 (from 1.9.2 using system RVM) on Ubuntu 10.04.3, I removed all of my gems, and attempted to reinstall pg (ala bundle install pg).
It then threw an error and informed me ...
15
votes
5answers
5k views
Rails Resque workers fail with PGError: server closed the connection unexpectedly
I have site running rails application and resque workers running in production mode, on Ubuntu 9.10, Rails 2.3.4, ruby-ee 2010.01, PostgreSQL 8.4.2
Workers constantly raised errors: PGError: server ...
34
votes
3answers
5k views
NOTICES for sequence after running migration in rails on postgresql Application
When i run my migration in Rails application on postgresql i got following NOTICES
NOTICE: CREATE TABLE will create implicit sequence "notification_settings_id_seq" for serial column ...
20
votes
16answers
14k views
Can't install pg gem on Windows
I've got 2 Ruby versions: 1.8.7 and 1.9.2 and PostgreSQL 8.3. I cant install pg gem on any of them. Getting this error:
C:/Development/Ruby187/bin/ruby.exe extconf.rb
checking for pg_config... yes
...
14
votes
8answers
15k views
Failing installing pg gem, “mkmf.rb can't find header files for ruby” (Mac OSX 10.6.5)
I just upgraded to rails3 and had a bit of a mess with macports/gems/databases to sort out. So I threw out all gems to install them fresh. Everything seems to be ok except for the aquirement of the pg ...
7
votes
1answer
5k views
Trouble installing pg gem
Trying to install the pg gem gives me errors.
I'm using Ruby 1.9.3-p125 built using rbenv/ruby-build. I installed PostgreSQL using the one-click installer. I'm able to connect to the DB using ...
7
votes
2answers
4k views
Rails: encoding woes with serialized hashes despite UTF8
I've just updated from ruby 1.9.2 to ruby 1.9.3p0 (2011-10-30 revision 33570). My rails application uses postgresql as its database backend. The system locale is UTF8, as is the database encoding. The ...
9
votes
4answers
11k views
Rails 4 LIKE query - ActiveRecord adds quotes
I am trying to do a like query like so
def self.search(search, page = 1 )
paginate :per_page => 5, :page => page,
:conditions => ["name LIKE '%?%' OR postal_code like '%?%'", search, ...
0
votes
2answers
709 views
Inserting an array using Sequel gem in PostgreSQL
i created a table with the following schema in code
DB.create_table :Pokemon do
primary_key :id
String :first_name
String :last_name
String :email
String :zipcode
String :company_name
...
10
votes
8answers
12k views
Repairing postgresql after upgrade to OSX Mavericks
A recent upgrade to OSX Mavericks has broken my database connection for my Rails app.
When I try to fetch from the database the server returns the following error:
PG::ConnectionBad (could not ...
18
votes
5answers
5k views
Heroku Rails 4 could not connect to server: connection refused
Using postgres.
Haven't been able to push.
Tried this without any luck:
config.assets.initialize_on_precompile = false
-----> Preparing app for Rails asset pipeline
Running: rake ...
7
votes
2answers
12k views
Trying to set up postgres for ror app, getting error - fe_sendauth: no password supplied
Getting:
An error has occurred:
Error connecting to the server: fe_sendauth: no password supplied
Settings in database.yml are the same as the app setup on other machines.
How can I set things up ...
5
votes
2answers
4k views
Problems setting a custom primary key in a Rails 4 migration
I use postgresql 9.3, Ruby 2.0, Rails 4.0.0.
After reading numerous questions on SO regarding setting the Primary key on a table, I generated and added the following migration:
class ...
15
votes
2answers
16k views
How to round an average to 2 decimal places in PostgreSQL?
I am using PostgreSQL via the Ruby gem 'sequel'.
I'm trying to round to two decimal places.
Here's my code:
SELECT ROUND(AVG(some_column),2)
FROM table
I get the following error:
PG::Error: ...
15
votes
1answer
5k views
Rails 3.2 Postgres Save Error “ActiveRecord::StatementInvalid: PG::Error: ERROR: Syntax error near 'T' at position 5”
My app has started throwing errors when I try to save a particular class to the database. I'm not sure exactly what caused this to start happening - I've been having all kinds of database issues for ...
9
votes
2answers
6k views
PG::Error: SELECT DISTINCT, ORDER BY expressions must appear in select list
ActionView::Template::Error (PG::Error: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
I'm creating an events website and I'm trying to sort the rendered rsvps by the ...
4
votes
3answers
1k views
Error requiring pg under rvm with postgres.app
I'm using Postgres.app on OS X (10.8.3). I have modified my PATH so that the bin folder for the app is before all others.
Rammy:~ phrogz$ which pg_config
...
0
votes
1answer
46 views
Ruby 'pg' gem linking to wrong copy of libpq.5.dylib (on OSX)
The EnterpriseDB installer for PostgreSQL 9.3 places its files in /Library/PostgreSQL/9.3/* on Mac OSX. However, the Ruby gem 'pg' loads a legacy version of the 'C' dynamic library libpq.5.dylib from ...
36
votes
1answer
14k views
Role does not exist and unable to create database when using PostgreSQL
I am using Heroku for my application and it requires PostgreSQL but you can still use SQLite3 for development. Since Heroku strongly advised against having 2 different databases I decided to change to ...
17
votes
2answers
10k views
getting error while installing PostgreSQL gem
I am learning Ruby on Rails and trying to develop an application.
In my application I am trying to use the default SQLite database in the Development Mode and PostgreSQL in the Production Mode.
But ...
12
votes
2answers
6k views
sudo gem install pg won't work
I'm trying to get Rails to work with PostgreSQL. Apparently one thing I need to do along the way is sudo gem install pg. When I do that, I get this:
jason@buster:~/projects$ sudo gem install pg
...
8
votes
3answers
369 views
Accounting for DST in Postgres, when selecting scheduled items
I have a Postgres table of clock alarms (not really, but this is analogous, and easier to explain). Alarms are set by users with a 1 hour resolution, and users can be from many different timezones. ...
9
votes
1answer
10k views
Rails can't login to postgresql - PG::Error - password - Correct info
This is how my database.yml file looks (obviously there are relevant entries for testing and production as well)
development:
adapter: postgresql
encoding: unicode
database: dbname_dev
pool: ...
4
votes
1answer
2k views
Installing PL/Ruby for PostgreSQL
This is to enable the development of postgres functions with embedded ruby code,
but I have been unable to build it.
As advised by
...
2
votes
1answer
3k views
Upload images in database
I want save uploaded images in a bytea column in my PostgreSQL database. I'm looking for advice on how to how to save images from Rails into a bytea column, preferably with examples.
I use Rails 3.1 ...
7
votes
5answers
12k views
pg_config, ruby pg, postgresql 9.0 problem after upgrade, centos 5
After upgrade postgresql 8.1 to 9.0 ive noticed issues with libraries dependency. Postgresql works fine (connection, queries).
yum list postgresql*
Installed Packages
postgresql.i386 9.0.0-1PGDG.el5 ...
3
votes
4answers
4k views
Rails 3.1 with PostgreSQL: GROUP BY must be used in an aggregate function
I am trying to load the latest 10 Arts grouped by the user_id and ordered by created_at. This works fine with SqlLite and MySQL, but gives an error on my new PostgreSQL database.
Art.all(:order => ...
8
votes
3answers
3k views
Travis CI: FATAL: role does not exist
I'm trying to get my application working w/ Travis CI but I keep getting: FATAL: role "skateparks" does not exist. Any ideas on what I could be doing wrong? I've followed their documentation.
...
3
votes
2answers
806 views
Rails not rolling back transaction after failed save()
I have this domain model: A user has group of items, and the state of the items can fail a validation.
Validation works fine, and I even see exceptions get called when I use save!.
In my controller, ...
2
votes
3answers
2k views
Detected sqlite3 gem which is not supported on Heroku
I'm trying to push my rails app to Heroku, and I keep getting the following error:
An error occurred while installing sqlite3 (1.3.8), and Bundler cannot continue.
Make sure that `gem ...
1
vote
2answers
127 views
Store date with optional month / day
I want to store date in my Postgres database.
The only problem is that this date can have optional day or even month.
Example:
User provides time period when he was employed - not necessary full date ...
0
votes
1answer
84 views
PostgreSQL Error on Heroku with “BETWEEN”
I am expierencing a strange problem on Heroku. I seems that in only accesses the Hosting Enviroment and not the Database.
I have created a little Test App, after expirencing a Problem to track it ...
49
votes
7answers
19k views
Pros/Cons of MySQL vs Postgresql for production Ruby on Rails environment?
I will soon be switching from sqlite3 to either postgres or mysql. What should I consider when making this decision? Is mysql more suited for Rails than postgres in some areas and/or vice versa? Or, ...
30
votes
1answer
6k views
Will UUID as primary key in PostgreSQL give bad index performance?
I have created an app in Rails on Heroku using a PostgreSQL database.
It has a couple of tables designed to be able to sync with mobile devices where data can be created on different places. Therefor ...
9
votes
2answers
4k views
Rails with PostGIS
First of all, I'm using Rails3 with Ruby 1.9.2.
I have a problem using PostgreSQL with PostGIS. I've tried two gems:
https://github.com/nofxx/georuby
...
6
votes
2answers
4k views
rails 3.2.2 (or 3.2.1) + Postgresql 9.1.3 + Ubuntu 11.10 Connection error
I am using PostgreSQL 9.1.3 (PostgreSQL 9.1.3 on x86_64-pc-linux-gnu, compiled by gcc-4.6.real (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1, 64-bit) and rails either 3.2.2 or 3.2.1 on ubuntu 11.10.
Now, I ...
7
votes
4answers
3k views
using the postgresql gem async
I'm using Goliath (which is powered by eventmachine) and the postgres gem pg, currently I'm using the pg gem in a blocking way: conn.exec('SELECT * FROM products') (for example) and I'm wondering ...
25
votes
4answers
7k views
How to do case-insensitive order in Rails with postgresql
I am in the process of switching my development environment from sqlite3 to postgresql 8.4 and have one last hurdle.
In my original I had the following line in a helper method;
result = ...
17
votes
2answers
4k views
ActiveRecord::StatementInvalid. PG Error
I am trying to find a project from Project model using Project.find(id) but it is giving me ActiveRecord::StatementInvalid error
Full trace-
PG::Error: ERROR: prepared statement "a1" already exists ...
7
votes
5answers
6k views
rails - postgres error: Reason: Incompatible library version: libpq.5.dylib requires version 1.0.0 or later,
I am stuck with the setup of Ruby (1.9.3), Rails and Postgres (9.0.8) on my Mac (10.6.8).
Everytime when I run rails console I get the following error:
...
3
votes
3answers
3k views
Can ActiveRecord connect to PostgreSQL remotely and protect the DB password?
I have a PostgreSQL DB on a remote VPS server (CentOS 5) and I'd like to connect to have a Rails application connect to it from my local Mac laptop. On my laptop, I have the ActiveRecord PostgreSQL ...
15
votes
4answers
9k views
Rails Migrations: tried to change the type of column from string to integer
I created a table in my rails app with rails generate migrations command. Here is that migration file:
class CreateListings < ActiveRecord::Migration
def change
create_table :listings do |t|
...
6
votes
3answers
4k views
Rake db:reset 'user does not have CONNECT privilege'
So I'm using Heroku Postgres in my Rails app, but I'm not hosting my app on Heroku itself. I used the Active Record connection details from Heroku in my database.yml, and it looks like this:
...
6
votes
2answers
2k views
Rails + PostgreSQL SSL decryption failure
I have an app running on my production server that uses the pg gem for talking to a Postgres database. Postgres is running on the default port, and is behind a firewall - so it's not accessible from ...
3
votes
2answers
2k views
Why I can't install postgresql with rails 4.0.0.rc1 (ruby 2.0)
first time on forum so i will try to be as specific as one can be, sorry for any possible typos ok?
I am relatively new to rails (less than a year), and i want to make a default project to work with ...
2
votes
1answer
2k views
Hstore and Rails
I'm trying to use Hstore in a Rails 3.2.9 project using the latest version of the activerecord-postgres-hstore gem and I am having a bit of trouble using the store_accessor provided by ActiveRecord ...
0
votes
1answer
124 views
Distance calculations using Postgis
I have a distance calculation in Postgres on a site that I did not build.
I programmed the script that inserts new locations in php because I know php better the ruby.
I am trying to figure out how ...
8
votes
1answer
4k views
Ruby Guard questions - 'Please install the sqlite3 adapter' - railstutorial.org
I am following along the Ruby on Rails Tutorial and have gotten somewhat confused in the testing section, in particular - 3.6.2 - Automated tests with Guard
As per the tutorial's instructions for ...