Search code examples
postgresqlheroku

How to check the output after heroku pg:sql?


I'm trying to run a select statement on a Postgres database on a free Heroku app.

I am running these commands commands in cmd:

  1. Log in to heroku
  2. chcp 1252
  3. heroku pg:psql -app "my-app-name::DATABASE"

I then get prompted by:

--> Connecting to postgresql-rectangular-44045
psql (13.4)
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.

And I can now write to my-app-name::DATABASE=> but regardless of what I write I don't get a response just another line starting with my-app-name::DATABASE->. I also checked the Heroku application logs (all processes) to see if the output got printed there but it was empty.

Am I missing something?


Solution

  • And I can now write to my-app-name::DATABASE=> but regardless of what I write I don't get a response just another line starting with my-app-name::DATABASE->

    Those two prompts are subtly different: the first ends with => and the second with ->.

    The -> prompt indicates that psql is waiting for more input for the same query, e.g. in case you want to split your query up into several lines for readability.

    Make sure to terminate each query with ; so psql knows you're done.

    See the first example here for more.