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
1 answer

Using empty parameters in quoted_parameters(params)

I have the following code: pg = ActiveRecord::Base.connection res = pg.execute(query % quoted_parameters(params)) This is my pseudoquery: select project_id from projects where client_id in (%{ids}) This is are the params: { :ids => [] } It works…
rept
  • 2,086
  • 1
  • 26
  • 44
0
votes
1 answer

Installing pg gem on windows crushes

I know that this problem is somehow known but none of posts could help me here. I am trying to install pg gem on Windows 8.1 (got among others: ruby 2.1.7.p400, PostgreSQL 9.5 32bit and devkit 32bit). In a GitBash I put: $ gem install pg --…
0
votes
0 answers

Ruby script cannot find table from PostgreSQL database (PG::UndefinedTable)

I'm trying to interact with my PostgreSQL database. I installed the 'pg' gem, and I'd like to execute a very simple script like this one: require 'pg' conn = PG::Connection.open('127.0.0.1' , 5432, nil, nil, 'postgres', 'postgres', 'admin') res =…
Roog
  • 1
  • 4
0
votes
1 answer

postgresql Rails native gem extension failure

I am trying to create a new rails-api project. I begin with the following command rails-api new -T -d postgresql, to which I receive the following: Gem files will remain installed in…
Nappstir
  • 995
  • 2
  • 20
  • 38
0
votes
2 answers

Error with installing pg gem. OS X 10.10.2

I have problems with installing pg gem. But bundle is successful. Maybe smith with "Can't find the PostgreSQL client library (libpq)" $ sudo gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config Building…
Said-Abdulla Atkaev
  • 4,193
  • 1
  • 11
  • 17
0
votes
0 answers

How to query a PostgresSql json database with Nodejs and PG

I have a postgreSQL database that stores all changes to table in json format, new_val and old_val It looks like this new_val {"id":6,"id_item_type":7,"id_contact_as_producer":2,"id_contact_as_owner":…
Hundurinn Nero
  • 83
  • 1
  • 2
  • 14
0
votes
1 answer

"PG::ConnectionBad: SSL error: point is not on curve" in Redshift via Ruby/PG gem using SSL

I'm getting the following error when trying to run a query on Amazon Redshift in Ruby (via the PG gem) over SSL: PG::ConnectionBad: SSL error: point is not on curve This error only happens on my local Mac OS X El Capitan machine when trying to…
Cody N
  • 1
  • 2
0
votes
1 answer

Rails App - with pg database - errors with setup

I am in rails setup hell. I tried to make an app 2 years ago and after endless problems with it, I tried to make a fresh app and start again. I"m now having the same problem I had the first time around in getting the pg database setup, but none of…
Mel
  • 2,481
  • 26
  • 113
  • 273
0
votes
1 answer

PG::UndefinedFunction: ERROR: function get_nearest_vertex_to_lon_lat(double precision, double precision) does not exist

I'm having a weird problem, I created a custom SQL function based on this suggestion. I have a model Route with a controller action create that calls this method on the model def get_route(startx, starty, endx, endy) query = "SELECT seq, cost,…
tvieira
  • 1,865
  • 3
  • 28
  • 45
0
votes
1 answer

PG::SyntaxError at / ERROR: syntax error at or near ")" Rails

I am getting this error some time and some time not. That is strange. ERROR: syntax error at or near ")" LINE 1: SELECT locations.*, () as distance FROM "locations" ORDER ... In line nearby_locations.includes(:events).each do |location| In…
Adt
  • 495
  • 6
  • 19
0
votes
1 answer

Rails_admin content of a model not being shown in table

I have created a model called 'Ad' and have created several row, but none is being shown in the table, only the number of ads is shown. I have many other models which work perfectly fine. What could possibly cause this? Is the name too…
harinsa
  • 3,176
  • 5
  • 33
  • 53
0
votes
1 answer

PG::ConnectionBad: PQconsumeInput() SSL error: key values mismatch

When I open a certificate with OpenSSL::PKCS12, I lose the connection with my database and occur the error: PG::ConnectionBad: PQconsumeInput() SSL error: key values mismatch. I'm doing this: myuser@developer:~/myapp$ rails c 2.2.3 :001 >…
0
votes
1 answer

passing variables to a rake job not proper on heroku

I am trying to pass a query to one one my rake jobs on heroku but the quotes are being deleted in a strange way my rake job is heroku run rake namespace:job_name FILTER_QUERY="'data like \"%test%\"'" -a heroku_project_name the error that I am…
MZaragoza
  • 10,108
  • 9
  • 71
  • 116
0
votes
0 answers

ActiveRecord pg adapter raw connection query returns strings for all data types

I have a table that looks like create_table "my_table", force: :cascade do |t| t.string "name", limit: 255 t.integer "size", limit: 4 end When I run result = ActiveRecord::Base.connection.execute("SELECT * FROM…
0
votes
1 answer

Failed to install pg 0.18.2 on iOS 10.10.5

I uninstall version 0.18.1 and now I cannot install any of the versions. I would like to install 0.18.2 I am running this command: gem install pg -v '0.18.2' Building native extensions. This could take a while... ERROR: Error installing pg: …
L.D
  • 1,279
  • 3
  • 15
  • 31