5 ms·
To complement this, I recommend installing `pgcli`[https://www.pgcli.com/ https://www.pgcli.com/]. It's a near-drop-in-replacement for psql, and gives autocompl
by NAR8789 6y ago
To complement this, I recommend installing `pgcli`[https://www.pgcli.com/ https://www.pgcli.com/]. It's a near-drop-in-replacement for psql, and gives autocompletion, syntax highlighting, and semicolon forgiveness.
Even as someone already comfortable with psql, pgcli is extremely handy.
- russelwilson 6y agoI second this motion.
- Cieplak 6y agoI went back and forth between psql and pgcli for several years, until I realized that pgcli tab-completes JOIN conditions.
- jessedhillon 6y agoPostgres supports JOIN USING. If your keys are named the same in both tables, say `user_id` then you can simply say SELECT * FROM parent JOIN child USING (user_id) I personally think naming your primary keys with their full name instead of calling all of them `id` or `key` is better practice also.
- EQYV 6y agoThanks! Just switched to this for a project I'm working on.
- qwertox 6y agoA drop-down autocomplete in a console? First time I've seen such a thing. Thanks for pointing out this tool.
- djeiasbsbo 6y agoThat's part of prompt toolkit, a python library for building cli applications. Its creator actually reimplemented a number of applications in python with similar additions. Check out pyvim, pymux, ptpython, pypager and ptterm.
- felixyz 6y agoAnd to complement that, I recommend Postgres Pager (https://github.com/okbob/pspg https://github.com/okbob/pspg)
- resheku 6y agopgcli is nice and it works great with pspg pager [https://github.com/okbob/pspg https://github.com/okbob/pspg] ''\pager /usr/local/bin/pspg''
- djeiasbsbo 6y agoI wish there was an oracle database equivalent. The oracle SQL REPLs are both terrible but the cx_oracle python client library is decent so maybe a pgcli fork would be possible.
- masklinn 6y agopspg supports MySQL and SQLite after sone configuration to their shell, might be possible for oracle as well?
- solarized 6y agoone big cons of pgcli appear when we deal with long query. even it support multiline and vi mode. we still can't integrate a formatter for convenient sake.