pg

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

假如想象 提交于 2019-12-08 17:26:24
问题 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 path as well (require /usr/local/rvm/gems/ruby-1.9.3-p194@railsTest/gems/pg-0.14.0/lib/pg/ ). The file 'pg_ext' is in fact present in the directory. Additionally, I can run the ruby script standalone without any problems (dbrubyscript.rb), however

How to set columns when using helpers in pg-promise

核能气质少年 提交于 2019-12-08 05:46:40
问题 Developed by node.js. I am using pg-promise. There is a problem with inserting the following data. I want to insert multiple rows of data into the table below. create table info ( id varchar(20) not null, name varchar(20) not null, createdate timestamp with time zone not null ) I inserted the data below. let info = [ { myid: '0001', myname: 'name1' }, { myid: '0002', myname: 'name2' }, { myid: '0003', myname: 'name3' }, ] I originally inserted the following. for (let i = 0; i <info.length; i

cannot connect to Postgres (pg) database from my Ruby Script using gem “pg”(This is not rails, just pure ruby)

元气小坏坏 提交于 2019-12-08 05:17:35
问题 I downloaded the postgres.app for my Mac OSX machine. I have a rails app that has connected and used the postgres DB that came with the postgres app. Now I am writing a pure Ruby test script (Not Rails, pure Ruby, not even Active Record) to try to connect to the postgres database instance. These are the steps I followed to set this up 1) ran this command on the terminal: gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config 2) Added this code to the test

How to set columns when using helpers in pg-promise

时光总嘲笑我的痴心妄想 提交于 2019-12-06 14:59:05
Developed by node.js. I am using pg-promise . There is a problem with inserting the following data. I want to insert multiple rows of data into the table below. create table info ( id varchar(20) not null, name varchar(20) not null, createdate timestamp with time zone not null ) I inserted the data below. let info = [ { myid: '0001', myname: 'name1' }, { myid: '0002', myname: 'name2' }, { myid: '0003', myname: 'name3' }, ] I originally inserted the following. for (let i = 0; i <info.length; i ++) { db.none (`INSERT INTO info (id, name, createdate ') VALUES ($1, $2, CURRENT_TIMESTAMP)`, [info[i

Not able to install pg gem on Ubuntu 12.10

给你一囗甜甜゛ 提交于 2019-12-06 10:28:43
I am using Ubuntu 12.10 64-bit and I have following packages installed : dpkg --get-selections | grep postgre output: postgresql postgresql-9.1 postgresql-client postgresql-client-9.1 postgresql-client-common postgresql-common postgresql-contrib postgresql-contrib-9.1 postgresql-server-dev-9.1 postgresql-server-dev-all libpq-dev libpq5 rvm 1.17.9 ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-linux] I am not able to install pg gem I am getting following error : ERROR: Error installing pg: ERROR: Failed to build gem native extension. /home/vedarthk/.rvm/rubies/ruby-1.9.3-p362/bin/ruby

error running gem install pg -v '0.15.1'

不羁的心 提交于 2019-12-05 23:09:52
问题 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 extconf.rb checking for pg_config... no No pg_config... trying anyway. If building fails, please try again with --with-pg-config=/path/to/pg_config checking for libpq-fe.h... no Can't find the 'libpq-fe.h header * extconf.rb failed * Could not create Makefile due to

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

元气小坏坏 提交于 2019-12-05 20:51:04
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 Date(row.birthday) , and this is the result that is sent to the client. The problem now is that the value that the client receives is in the standard ISO 8601 format with the time part and the Z . When the client tries to create a new Date object from this string, the client may have an erroneous date value based on where the client is located. For

Cannot install pg gem

China☆狼群 提交于 2019-12-04 09:28:24
I finally managed to get the 'pg' gem install after spending hours trying to figure out why it's not working... at the end I entered sudo env ARCHFLAGS="-arch x86_64" gem install pg -v 0.12.2 -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config which worked like a charm. But now I still have the same error when I try bundler - so I guess I didn't really solve the problem? Anyway, here's what bundle install is saying: Installing pg (0.12.2) Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /Users/thomas/.rvm/rubies/ruby-1.9.3-p392/bin/ruby

How can i setup the path for heroku postgresql app?

99封情书 提交于 2019-12-04 08:34:25
问题 I just installed the heroku PSQL app (v1.0) and i'm having trouble being able to connect my rails apps using the gem pg "0.1.4". I already added the path PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH" to my .profile and my .bashrc files, but nothing seems to allow me to run psql simply by calling "psql". I had success using "psql -h localhost". When i go for "psql" i get: Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432

Error Installing PG Gem on Windows

笑着哭i 提交于 2019-12-04 06:01:02
问题 I'm using XAMPP as my installation folder for PostgreSQL 9.3. C:\xampp\pgsql\9.3 And now I'm trying to install PostgreSQL gem using that directory as a reference: gem install pg -- --with-pg-include="C:\xampp\pgsql\9.3\include" --with-pg-lib="C:\xampp\pgsql\9.3\lib" --with-pg-config="C:\xampp\pgsql\9.3\bin\pg_config" But this command failed with errors listed below: ERROR: Error installing pg: ERROR: Failed to build gem native extension. C:/Ruby/Ruby200/bin/ruby.exe extconf.rb --with-pg