News for hackers. Stuff that matters.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by ibotty on Thursday June 18, 2015 @09:19AM (#9738307)
You are the first person I read saying they like the mysql cli. Ctrl-c kills the whole shell. great, but not what I expect. Want to fix a small typo in your big query? In psql you can just edit your last command in your $EDITOR. Useful (but not perfect) autocomplete is also not in mysql.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by fweespeech on Thursday June 18, 2015 @10:26AM (#9738680)
> Ctrl-c kills the whole shell. great, but not what I expect.

That is actually exactly what you should expect. SIGINT cancels most things you run in the CLI.

Interrupt a ping because you forgot a count parameter? Ctrl+C

Honestly, the reason I don't use Postgres has nothing to do with the CLI and everything to do with the ecosystem for Multi-Master being inferior to Galera. But yeah, I'm happy with mysql-cli as well and don't really see the Postgres equivalent as a noteworthy improvement.

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by antsar on Thursday June 18, 2015 @10:49AM (#9738837)
Ping isn't a CLI, its a single command that expects no further input. A database shell is more like bash than ping. And Ctrl-C does not exit out of bash.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by juliangregorian on Thursday June 18, 2015 @07:16PM (#9742168)
Many language REPLs don't exit on ctrl+c either, at least I know Ruby and Python don't. Node will, but it will make you do it twice.
[deleted]
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by dllthomas on Thursday June 18, 2015 @12:12PM (#9739555)
Ctrl-C conventionally does not kill shell-like things. This is, technically, of course because of cooperation of those shell-like things and their handling of SIGINT, but that's not actually relevant.

The following things (off the top of my head, and quickly verified) all handle Ctrl-C so that it kills only the current command and not the containing process:

bash, zsh, csh, ksh, mail, gnuplot, gdb, psql, vsql, python (interactive), ghci

While I object to captive user interfaces in general, if you're going to have one then handling ctrl-c inside it is the right thing to do.

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by jsight on Thursday June 18, 2015 @10:41AM (#9738772)
In Postgres' psql, Ctrl-C cancels the current statement. That's a more useful behavior than killing the entire psql process, IMO.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by meritt on Thursday June 18, 2015 @10:42AM (#9738780)
In MySQL type \e and you can edit your query just the same.

https://dev.mysql.com/doc/refman/5.6/en/mysql-commands.html

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by tonyarkles on Thursday June 18, 2015 @11:42AM (#9739295)
I love that earlier up in this same thread people are complaining about the magic \x sequences in postgres and this is how you do query edits in the mysql cli :)

I've got my biases, but whenever something like this comes up, I just make some popcorn and enjoy the show.

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by thwarted on Thursday June 18, 2015 @09:34PM (#9742615)
The complaint was that in psql the backslash sequences are a combination of client operations (\copy, \html) and database metadata operations (\d) [0], which while extremely rich, are a huge list and are not very intuitive to learn. Many differ on case (\df vs \dF). \des and \deu mention the mnemonics for why these are named that way. "External servers" listing "foreign servers" I can understand, but it seems that "external users" are not actually "external".

In MySQL the backslash sequences are commands to the mysql client for things that are implemented in the client and have to do solely with the command line client software. These things are not available using other clients. Vs things like listing columns and databases and functions have their own DDL language constructs entries and are queries in their own right that can be sent by any client software to the server and return iteratable results. MySQL is more like Oracle in this regard.

That distinction isn't obvious in psql and that contributes to a larger hurdle when using the command line client. This makes psql attractive to power users, as there are a lot of shortcuts for things that might require longer DDL statements to be typed or queries against information_schema.

[0] http://www.postgresql.org/docs/9.0/static/app-psql.html

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by lmm on Thursday June 18, 2015 @04:50PM (#9741537)
It's not really possible to implement "edit the query I'm already partway through" with anything other than a magic sequence. Doesn't mean magic sequences are the right way to do everything.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by ams6110 on Thursday June 18, 2015 @08:22PM (#9742387)
Whenever I do anything more than a oneoff SQL statement (and often even then) I'll use emacs with sql-mode. It supports all the major SQL dialects and cli utilities.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by mdemare on Thursday June 18, 2015 @09:27AM (#9738352)
> In psql you can just edit your last command in your $EDITOR.

Cool! How?

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by masklinn on Thursday June 18, 2015 @09:41AM (#9738418)
`\e` will edit whatever is in the query buffer (`\p` shows the content of the query buffer)
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by turrini on Thursday June 18, 2015 @09:42AM (#9738430)
Just type \e [ENTER]
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by xd on Thursday June 18, 2015 @09:36AM (#9738399)
Autocomplete is in MySQL you might just need to enable it with -A or in the config comment out no-auto-rehash.