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

pg gem install fails saying version is too old?

I am trying to install the pg (PostreSQL) gem for Ruby. I am receiving this error: postgres/9.2-pgdg/bin/64/pg_config Using config values from /location/to/install/postgres/9.2-pgdg/bin/64/pg_config checking for libpq-fe.h... yes checking for…
arrowill12
  • 1,784
  • 4
  • 29
  • 54
9
votes
2 answers

connection.select_value only returns strings in postgres with pg gem

I'm converting a rails app from using mysql (mysql2 gem) to postgres (pg gem). With mysql, ActiveRecord::Base.connection.select_value calls return values typed according to the data, for example: > ActiveRecord::Base.connection.select_value("SELECT…
Monica Woods
  • 147
  • 1
  • 6
9
votes
3 answers

Rails/Ruby/Postgres - LoadError cannot load such file -- pg_ext

I am trying to call a Ruby script (which connects to a postgres db) using the rails controller below, however it appears it is having problems loading one of the PG gem files. I have set my require statement to require 'pg' and tried the absolute…
user1562080
  • 91
  • 1
  • 1
  • 2
8
votes
1 answer

Is there a more concise way to check if PGResult is empty?

I'm using the pg gem to talk to PostgreSQL from Ruby. Is there a better way to check if there are no results than using res.ntuples == 0? conn = PGconn.connect config cmd = "select * from labels inner join labels_mail using(label_id) " + "where…
dan
  • 43,914
  • 47
  • 153
  • 254
8
votes
5 answers

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 installed postgresql-debuginfo.i386…
objah
  • 141
  • 1
  • 1
  • 3
8
votes
2 answers

PG::UnableToSend: no connection to the server in Rails

I have a production server running ubuntu 14.04, Rails 4.2.0, postgresql 9.6.1 with gem pg 0.21.0/0.20.0. In last few days, there is constantly error with accessing to a table customer_input_datax_records in psql server. D,…
user938363
  • 9,990
  • 38
  • 137
  • 303
8
votes
0 answers

Attempted to delete invisible tuple + Postgres

I have system where we perform large number of inserts and updates query(something upsert as well) I see occasionally error on my logs that states .. PG::ObjectNotInPrerequisiteState: ERROR: attempted to delete invisible tuple INSERT INTO…
LivingColors
  • 123
  • 7
8
votes
3 answers

gem install pg not working on Mac El Capitan

I tried to install pg Gem on Mac El Capitan, but I always get this error: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb…
Ricardo Silva
  • 380
  • 4
  • 15
8
votes
6 answers

PostgreSQL gem for rails won't install, even when both home brew and app are installed

I have tried following this answer to get the gem to work, but it wont. I have my projects set up such that individuals projects have there own gems instead of all themes gems living in global space, and then I use binstubs to allow me to do things…
TheWebs
  • 12,470
  • 30
  • 107
  • 211
8
votes
3 answers

Working on a rails app locally with a remote Postgres connection?

Is there a way to configure the database.yml file to connect to Heroku's Postgres remotely? I'm having trouble understanding how Heroku, Rails and PG gem work together. It looks like during deployment, Heroku re-writes the database.yml file - is it…
dsp_099
  • 5,801
  • 17
  • 72
  • 128
8
votes
1 answer

error running gem install pg -v '0.15.1'

Running gem install pg -v '0.15.1' giving errors: Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. /home/askar/.rvm/rubies/ruby-1.9.3-p429/bin/ruby…
Askar
  • 5,784
  • 10
  • 53
  • 96
8
votes
1 answer

Postgres WARNING: errors ignored on restore: 59

I'm using the pg:transfer utility recommended by Heroku to push and pull databases. For example: heroku pg:transfer -f postgres://username:password@localhost/database-name -t postgres://user-name:password@host-name/database-name --confirm…
anthony
  • 391
  • 1
  • 3
  • 15
7
votes
4 answers

How to correctly load a gem extension in AWS Lambda

I'm having trouble working through a gem load error on AWS Lambda. { "errorMessage": "LoadError: libpq.so.5: cannot open shared object file: No such file or directory - /var/task/vendor/bundle/ruby/2.5.0/gems/pg-1.1.4/lib/pg_ext.so", …
1ijk
  • 1,417
  • 2
  • 19
  • 31
7
votes
0 answers

Using A Proxy With Ruby PG Gem

I'm developing a Rails application on Heroku that needs to make callout's to our customer's databases. We have setup a proxy to make our outbound IP address static and are now configuring our 'connection' classes to use that proxy. My trouble is…
7
votes
4 answers

Can we always fetch date column as string (varchar) with knex and postgres?

I have a column in postgres database with type date. It is a column like birthday, which is just a date and does not need to have a time part. When fetching this column with knex, the result is a javascript Date object. It is presumably doing new…
squgeim
  • 2,321
  • 1
  • 14
  • 21