Reputation: 3812
I am trying to use Postgresql with Heroku. I installed Postgres 9.1.4 using the installer downloaded from http://www.enterprisedb.com/products-services-training/pgdownload. Then in my /etc/profile
I added the location of psql
to my PATH
. When I attempt to use the psql
shell with Heroku I get a segmentation fault but it seems to work fine when I try to use it locally:
[Sun Aug 05 20:17:47] : which psql
/Library/PostgreSQL/9.1/bin/psql
[Sun Aug 05 20:22:15] : heroku pg:psql
psql (9.1.4)
Segmentation fault
[Sun Aug 05 20:22:21] : psql -U postgres
Password for user postgres:
psql (9.1.4)
Type "help" for help.
postgres=# \q
[Sun Aug 05 20:22:29] : heroku version
heroku-toolbelt/2.30.2 (universal-darwin10.0) ruby/1.8.7
I did notice that heroku version
shows ruby/1.8.7
but I am using rvm use 1.9.3
. Could this Ruby mismatch be the problem? If so, how do I fix it? I am not sure what to do next since the segmentation fault error message was pretty vague. This is all on Mac OS X 10.6.8.
Upvotes: 2
Views: 2196
Reputation: 2542
We definitely just defer to the psql command with arguments as has been mentioned, so I don't really think anything is really wrong on the Heroku side. It seems to be that there was a bug in psql that evidently got fixed, so I think updating your local postgres should probably do the trick (it seems to have fixed things for everyone I've talked to about it so far anyway.
Upvotes: 1
Reputation: 91
I was having exactly the same problem. On Heroku's advice I just updated from postgres 9.1.4 to 9.1.5 and now "heroku pg:psql" works fine.
Upvotes: 1
Reputation: 115
I also have this problem too: psql
works locally, but segfaults with heroku pg:psql
. I found that downgrading to Postgres 9.1.3 (installer still available) solved it.
It looks like the heroku pg:psql
command just calls psql
with appropriate command line arguments and somehow passes the password in. I can reproduce the problem without the heroku
command like this:
psql -U random_username -h ec2-10-10-10-10.compute-1.amazonaws.com -p 5432 random_dbname
Password for user random_username:
psql (9.1.4)
Segmentation fault
So it appears the problem lies in the psql
binary. I looked at the stack trace of the core dump, and it appears the problem is something in the SSL processing (which Heroku uses, but isn't usually used with a connection to localhost):
#0 0x00000001000da622 in SSL_get_current_cipher ()
#1 0x0000000100007415 in printSSLInfo ()
#2 0x00000001000073c6 in connection_warnings ()
#3 0x00000001000141dd in main ()
This makes sense because a successful psql
connection to Heroku does spit out a line about the SSL cipher connection:
heroku pg:psql --app wattdepot-kukuicup-uhm-staging
psql (9.1.3, server 9.1.4)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.
random_dbname=>
I haven't investigated any further than that.
Upvotes: 1
Reputation: 3812
I contacted Heroku support and they suggested installing Postgres via Homebrew (http://mxcl.github.com/homebrew/). I did this and now I can access my Heroku databases.
Upvotes: 1