weelyat · 2022-10-27 14:38
I'm currently operating in a strict environment in which "idle" TCP sessions are dropped (at the router level is my guess). M-x sql-postgres prompts for user, host, password and then starts a psql session (comint). I need to instead use the URL form - postgres://host?keepalives\_idle?et\_al - but need help getting that sent properly. I've tried setting sql-connection-alist
(setq sql-connection-alist '(db (sql-product 'postgres)(sql-database 'postgres://host/dbname?keepalives\_idle=60&keepalives\_count=10)))
but still get prompted for host/user. (I have a .psqlrc file so no password needed)
All this on linux platforms, emacs version is 25 sadly
Any pointers appreciated.
weelyat · 2022-10-27 15:36
uh-oh. I've broken emacs :)
is my setq shown syntactically correct? (not an elisper though diehard emacs user (or is that self contradictory?))
weelyat · 2022-10-27 16:00
I have sent mail to help-gnu-emacs but the moderator didn't think it had anything to do with emacs. Title: sql-postgres connect using URL. I suspect the moderator is not an sql user ;)
I've appealed but nothing yet.
weelyat · 2022-10-27 19:50
Just heard from gnu-emacs-help list master: they're currently getting bombarded with spam(vimmers??) - but my appeal was successful, so here's hoping...
weelyat · 2022-10-30 13:51
So far the best answer is to connect using usual method (sql-postgres) to get in to any (default, postgres) db and then from there use psql "\\c" command to connect to desired db filling in the keepalives settings.
`\c "host=<host> user=<user> dbname=db keepalives_idle=<n> keepalives_interval=<m> keepalives_count<10>"`
This might be the only real solution anyway. I did get a suggestion on the emacs mail list suggesting redefining one of the internal connection variables but I've subsequently misplaced it. However, that would work for the first connection but any subsequent "\\c" would likely cancel (not include) the keepalives.
Still looking for that suggestion as it would be nice to get properly connected from the outset.