Questions tagged [pg]

'pg' is the name of an extension for Ruby that provides access to libpq, the C application programmer’s interface to the PostgreSQL RDBMS.

pg is the name of an extension for Ruby that provides access to libpq, the C application programmer’s interface to the PostgreSQL RDBMS. It provides a relatively complete mapping, including both synchronous and asynchronous query interfaces, notifications, support for the COPY command, and m17n support under Ruby 1.9.

It includes full RDoc API documentation, a copy of which can be found on the maintainer's site.

It is currently maintained and developed by Michael Granger.

854 questions
0
votes
0 answers

postgresql gem with ruby 2.0.0-p353 on mac wont suceed

I'm trying to bundle a new rails app using Postgres. I get this error each time I try to bundle. Errno::EACCES: Permission denied - /usr/local/var/rbenv/versions/2.0.0- p353/lib/ruby/gems/2.0.0/gems/pg-0.17.0/.gemtest An error occurred while…
0
votes
2 answers

postgresql rails price range filter with between

I have the following array of price ranges how can I perform a query to find the price range between these using and operator This is the array I have ["0-1000", "5001_15000", "15001_25000"] Whether this is the only way I have to perform else is…
kndwsu
  • 371
  • 1
  • 8
  • 21
0
votes
1 answer

How do I get the latest records depending on the foreign key

I am using rails with postgres. I have a table called 'attempts' which belongs to a 'users' table. I want to retrieve all attempts but only show the latest attempt for each user. So I want code something like…
sonnyhe2002
  • 2,091
  • 3
  • 19
  • 31
0
votes
2 answers

Removing Column Names From PG Gem Return Values

I am trying to retrieve a list of URLs from my Postgres DB, using the following method... def get_urls(site_id) conn = PGconn.open(:dbname => 'my_listings') res = conn.exec("SELECT url_list FROM listings WHERE site_id=#{site_id}") array = [] …
HMLDude
  • 1,547
  • 7
  • 27
  • 47
0
votes
1 answer

Setup postgres database with Rails app on Ubuntu

Now I'm a little shaky with Ubuntu and postgres, but here is what I've currently done. In Ubuntu, I've created a user, called postgres, with a password of postgress: $ sudo adduser postgres Enter new UNIX password: (I typed ' postgres ' here) Retype…
Starkers
  • 10,273
  • 21
  • 95
  • 158
0
votes
1 answer

Express.js structure for node-postgres (pg) and mongodb

First off, I'm fairly new in terms of knowing the performance cost of making a database connection from the server, so excuse me if I say something I may not have meant. I'm currently taking a mongodb class for node.js, and I was really fascinated…
user1164937
  • 1,979
  • 2
  • 21
  • 29
0
votes
1 answer

Why I can't migrate database of my rails project on Heroku?

I have an existing rails (3.2.14) project on Heroku and need to migrate database. But when I try to run action: heroku run rake db:migrate I just get an error. When we have an R99 error (heroku logs below) it's mean a platform trouble. But…
Nick Klius
  • 23
  • 7
0
votes
0 answers

Two Terminal sessions with different results

I'm setting up a new computer to use an existing Rails application (Rails 3.2 with Postgres). I installed postgres via homebrew, along with the Lunchy gem as documented here:…
panzhuli
  • 2,890
  • 6
  • 33
  • 46
0
votes
0 answers

no records showing after migration to postgres

Just followed the "Migrating to PostgreSQL" Railscast, migrating my local sqlite3 database to postgres: here is my database.yml file: development: adapter: postgresql encoding: unicode database: app_development pool: 5 host: localhost …
DonMB
  • 2,550
  • 3
  • 28
  • 59
0
votes
1 answer

Cannot connect to server when using nitrous

I'm using nitrous on a PC (Windows 7), and having trouble connecting to the server (using ruby on rails). It worked perfectly yesterday (same project, same computer). The error I'm getting: psql: could not connect to server: No such file or…
steelerose
  • 153
  • 1
  • 13
0
votes
3 answers

Check db status through DATABASE_URL

I've been given access to Heroku application with rather strange setup. It has one database but when I run heroku config, I get different DATABASE_URL and HEROKU_POSTGRESQL_BRONZE_URL. When I run heroku pg:info I get the following result: ===…
Viktor
  • 2,982
  • 27
  • 32
0
votes
3 answers

Rake db:create fails on Library not loaded

I was running PostgreSQL 9.1, installed from Postgres (/Library/PostgreSQL/9.1) - ie not homebrew etc and on Mac OSX Leopard. I upgraded to Snow Leopard and then immediately to Mountain Lion and had a mass of problems with gems failing to build etc,…
Mitch
  • 1,017
  • 1
  • 13
  • 25
0
votes
1 answer

Activerecord PG Update From Select

I have a table that i need to add a new field and copy the value into another field. Now this table has way to many records so i can just loop on each record and update it one at the time. What would be the best way to do this. My DB is PG but i…
MZaragoza
  • 10,108
  • 9
  • 71
  • 116
0
votes
1 answer

PG::ERROR M. Hartl's Ruby on Rails Ex. 3.5.3

Noob here trying to work through M. Hartl's Ruby on Rails Tutorial. Attempted the advanced exercise #3.5.3 to change the database adapter from sqlite3 to PostgreSQL. Now I'm getting all sorts of errors. I would like to continue this struggle with…
0
votes
0 answers

How to get interval results from postgresql as integers in rails

I am running a query in rails to get the delay between two events in minutes. I have this working nicely as follows; orders.select("extract(epoch from (orders.procedure_time - orders.call_time)) / 60 AS delay").map &:delay where orders is an…
brad
  • 9,573
  • 12
  • 62
  • 89