cli icon indicating copy to clipboard operation
cli copied to clipboard

Ctrl+C in pg:psql exiting

Open afn opened this issue 7 years ago • 1 comments

I believe this is the same issue originally reported in https://github.com/heroku/heroku-pg/issues/116. I'm seeing it with the current version of heroku-cli:

[afn]$ heroku update
Updating completions... ⡿ [1/4] Resolving packages...
Updating completions... ⣻ [1/4] Resolving packages...
[afn]$ heroku --version
heroku/7.25.0 linux-x64 node-v11.14.0

Current behavior: hitting Ctrl+C inside pg:psql interrupts the current query but does not cause psql to exit

Actual behavior: psql exits immediately on Ctrl+C. It also ends up printing some output after control has returned to the shell.

Example:

[afn]$ heroku pg:psql -r prod
--> Connecting to postgresql-xxx-xxx
psql (11.2, server 9.6.12)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.

xxx::DATABASE=> select pg_sleep(5);
^C !    Command cancelled.
[afn]$ Cancel request sent
ERROR:  canceling statement due to user request
amitree::DATABASE=> 
\q
[afn]$ 

afn avatar Jun 21 '19 15:06 afn

@afn this issue appears to have been resolved and I've verified in the latest v11 version of the CLI.

$ heroku --version                                                                      
heroku/11.0.2 darwin-arm64 node-v22.22.2
$ heroku pg:psql -a [app]
--> Connecting to ⛁ postgresql-xxx-xxxx
psql (18.2 (Postgres.app), server 14.18 (Ubuntu 14.18-1.pgdg20.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off, ALPN: none)
Type "help" for help.

xxx::DATABASE=> select pg_sleep(5);
^CCancel request sent
Cancel request sent
ERROR:  canceling statement due to user request
xxx::DATABASE=>

heroku-johnny avatar Mar 31 '26 15:03 heroku-johnny