`heroku pg:psql` doesnt work but psql works - postgresql

Note: I'm on windows.
After installing postgreSQL in my computer trying to use heroku pg:psql gives me this error:
--> Connecting to postgresql-defined-56809
! The local psql command could not be located. For help installing psql, see
! https://devcenter.heroku.com/articles/heroku-postgresql#local-setup
The psql command works and psql --version returns the same version that my database uses on heroku as returned by heroku pg:info.
I have followed the instructions in that link and it still doesn't work (well I did that from the beginning). I even restarted my computer but it still doesn't work.
Edit: found that psql runs in powershell but not in cmd

Okay so after trying to set up the PATH from cmd I think I messed something up and the heroku command didnt work anymore and I reinstalled heroku and now everything works fine. What a waste of time.

Related

Can't find pg_dump generated file after running on Google Cloud SQL server

I ran:
psql "sslmode=disable dbname=postgres user=postgres hostaddr=[INSTANCE_IP]"
yes I put my google cloud instant's IP here and authed just fine and got to the postgres prompt
Then I ran this:
pg_dumpall --schema-only > ~/grinds/desktop/definitiononly.sql
grinds is my OS X laptop
but I don't see the definitiononly.sql file anywhere in OS X. Was it created on the server?? I didn't think so, pretty sure it should output to my PC.
Same thing happened when I used the Google Cloud Console:
The operation did nothing after I hit enter so I assumed it worked but can't tell
pg_dump is a program. It is run from the Linux command line (eg bash), not the SQL command line (eg psql). You would have gotten a syntax error, except psql allows multiline commands that are ended by a semicolon and a newline, not by just a newline.

Heroku pg:psql stalls out

When i run heroku pg:psql i get --> Connecting to postgresql-cylindrical-38664
and stalls out. Everything is looking good to go, it just gets stuck and doesn't do anything.
I seem to have the same issue in gitbash but when using command prompt, it seems to work.
In command prompt, this works: heroku pg:psql --app={appnameinheroku}.
You can see the apps you have to choose from by running heroku apps.
On Windows when using GitBash or Command Prompt you may encounter this issue.
The fix that works only in Command Prompt is: heroku pg:psql --app herokuappname

How can I confirm that Postgres had been installed properly for Heroku use?

I am using Heroku and thus the Postgres is needed to be properly installed.
I used the Windows Installer "postgresql-10.1-3-windows-x64.exe" for my installation, and there was not special interruption during the installation.
However, after I deployed a Heroku app on web, and try to run ">pipenv --three" in my cmd windows, there's a message of ' "command" is not recognized as an internal or external command, operable program or batch file.', which make me not sure whether Postgres is properly installed.
I also tried to run the command "heroku pg:psql", and the result is as below:-
heroku pg:psql
Is that really because the Postgres is not properly installed, and how can I get it fixed? Thank you in advance for the help!
Environment:-
Windows 10 Home - 64-bit
Postgre Installer: postgresql-10.1-3-windows-x64.exe
Heroku: heroku-cli/6.15.18-fd2097 (win32-x64) node-v9.3.0
I finally got it solved, by adding the following into the $PATH.
%APPDATA%\Python\Python36\Scripts
It's not the matter of the installation.
Thx.

Postgres.app setup for heroku

I'm trying to install Postgres.app on my mac (lion), and running into issues.
I'm trying to follow the instructions here: https://devcenter.heroku.com/articles/heroku-postgresql#local-setup.
So, as the first step I downloaded the app here: http://postgresapp.com/.
Next, I opened the documentation here:http://postgresapp.com/documentation.
When I run $ psql -h localhost, it asks for a password, and I have no idea what the password is supposed to be. Can somebody help with figuring out how to set Postgres.app as the default database for using Heroku?
Thanks.
You're probably using the psql that comes built-in to Mac OS X, thanks to Apple's incredibly frustrating decision to bundle an (old) PostgreSQL on the default port and with its tools on the default PATH.
Check psql --version to see what you're running.
Quite likely you need to set your PATH so it finds the psql from Postgres.app . Or you can check what port Postgres.app is running on and specify a port, though if you use an old psql with a new PostgreSQL then you'll have issues with backslash commands. This is explained just a few paragraphs down in the documentation you were reading.

Push local postgresql database to heroku: The local psql command could not be located

I'm trying to push a local postgresql database to my heroku project. Unfortunately, it doesn't work.
Postgresql works perfectly on my computer and the psql command works as well (Path is set correctly to the bin folder)!
But when I try to push my databse with
heroku pg:push mylocaldb HEROKU_POSTGRESQL_MAGENTA --app sushi
(with my db name as mylocaldb and my real app name), it doesn't work at all.
Problem: The local psql command could not be located
Why? As said before, psql works fine. Even a reinstall of postgresql doesn't help.
The pull statement (see: doesn't work either because postgres always wants to authenticate as my windows user (I don't know how to change the user name when using the heroku pg:pull command, this didn't help: https://devcenter.heroku.com/articles/heroku-postgresql#pg-push-and-pg-pull)
Thanks for your help!
Have you tried calling the psql command with its full path?
For example: /opt/PostgreSQL/9.1/bin/psql
Or if that doesn't help, you can try this