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
25
votes
3 answers

ARM64 architecture (M1 chip): Cannot install pg gem (using PostgresApp)

I've been trying to install a rails project on my computer (Macbook Pro 2020 with M1) running Big Sur. I have the PostgresApp installed. When running bundle install it fails to build the pg gem so I tried to install the gem manually (by doing gem…
Tiago
  • 673
  • 1
  • 8
  • 24
23
votes
3 answers

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 that I should look at mkmf.log, both of which are…
Sam Whited
  • 6,880
  • 2
  • 31
  • 37
23
votes
3 answers

Why can't the pg gem be installed in AWS Elastic Beanstalk?

I am deploying a simple application to AWS Elastic Beanstalk. However, the moment I put gem 'pg' in the Gemfile and push these to Elastic Beanstalk. I get the following errors in my…
22
votes
3 answers

Does pg (node-postgres) automatically sanitize data

I am using node-postgres for a production application and I am wondering if there is anything I should be concerned about? Is the data sanitized automatically by node-postgres? I couldn't find anything about it on the github page:…
Luke Schlangen
  • 3,722
  • 4
  • 34
  • 69
21
votes
4 answers

pg.connect not a function?

There appears to be a lot of documentation (e.g. https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-node-js, but also elsewhere including this site) indicating that the proper method of connecting with the pg.js Node package is…
user1837296
  • 596
  • 1
  • 4
  • 13
20
votes
2 answers

Raw DB querying in Rails

I'm trying to run the following raw query in rails, only to see it fail: query = 'SELECT * FROM users WHERE id IN ($1);' results = ActiveRecord::Base.connection.exec_query(query, "My query", [ [1,2] ]); What am I doing wrong? The error I'm…
oldhomemovie
  • 14,621
  • 13
  • 64
  • 99
20
votes
8 answers

Installing pg gem; ERROR: Failed to build gem native extension

After updating to OS X 10.9 Mavericks I tried to start a Rails 3 app, but the connection to the PG database was not working. Checking on PGAdmin III, the database is still there and it works fine. So I tried to reinstall the pg gem: gem uninstall…
Abramodj
  • 5,709
  • 9
  • 49
  • 75
20
votes
4 answers

Install libpq-dev package error

I tried to install pg gem and I have had this warning: You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. So I tried install libpq-dev package and I have had…
KRH
  • 339
  • 1
  • 2
  • 12
19
votes
2 answers

Rails raw query for csv format, to be returned via controller

I was using active record to get my stories and then generate a CSV, the standard way as done in the rails cast. But I have a lot of rows and it takes minutes. I think if I could get posgresql to do the csv rendering, then I could save some…
penner
  • 2,707
  • 1
  • 37
  • 48
19
votes
2 answers

PG::Error: ERROR: relation "users" does not exist

sorry for disturb you but i have a lot of question about this error. first this is my user_controller rspec file require 'spec/spec_helper' describe UserController do it "create new user" do post "create" assigns[:users].should_not…
Asantoya
  • 247
  • 1
  • 4
  • 12
17
votes
3 answers

Set default value for Postgres JSON column in Rails < 4

So I'm starting to use the Postgres JSON datatype, now that there's a lot of fun stuff you can do with it. In one of my Rails apps which is not yet Rails 4 (where support for Postgres JSON has been added) I added a JSON column like…
Manuel Meurer
  • 3,238
  • 6
  • 35
  • 50
14
votes
1 answer

"Error": "invalid input value for enum" only when using pg package in application to do INSERT SQL operation

I am beginning to build out the user authentication part of my application and I am using PostgreSQL as my database. I have a table set up in PG with the following code. This is the code I used to set-up my USERS table. When I did INSERTS in the…
brff19
  • 760
  • 1
  • 8
  • 21
14
votes
3 answers

rails 4.2.0: can't install pg gem on ubuntu 14.04

I have recently tried to upgrade my rail 3.2* application to rails 4.2.*. But, I was stopped while installing the 'pg' gem. When I googled it, the solutions which are mostly related to OSX only. But I'm using ubuntu 14.04. Need any suggestion for…
Mr. Black
  • 11,692
  • 13
  • 60
  • 85
14
votes
3 answers

Rails migration is always inserting whitespaces or changing the ordering of columns in the schema

There is a frustrating issue where my rails migrations update the schema with whitespaces and the position of the table's columns. So most times when I run bundle exec rake db:migrate it will do one of the below scenarios. When I merge this into our…
Coderama
  • 11,050
  • 12
  • 44
  • 58
14
votes
1 answer

Example of a prepared INSERT statement using ruby pg gem

Did some googling for about half a day and I can't find any sample of a prepared INSERT statement using the pg gem (postgresql ruby gem). I tried this (after looking at the gem docs): def test2 conn = PG.connect( dbname: 'db1' ) …
iphone007
  • 496
  • 1
  • 5
  • 15
1
2
3
56 57