News for hackers. Stuff that matters.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by tempodox on Thursday June 18, 2015 @08:50AM (#9738192)
That title is really great, and also rings true. And of all open-source SQL DBs, PostgreSQL is superbly executed and a breeze to work with. I can only recommend it.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by lmm on Thursday June 18, 2015 @08:53AM (#9738202)
As someone who's used to MySQL, I keep trying to use PostgreSQL (better standards compliance, better behaviour in the face of bad data) - and I keep going back. The psql interface is awkward (too many magic backslash commands to memorize instead of SHOW CREATE TABLE) and always feels slightly laggy somehow.
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.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by keithy on Thursday June 18, 2015 @09:10AM (#9738267)
The backslash commands are way better than having to type out SHOW TABLES; or SHOW DATABASES;, or CONNECT DATABASE X. All I have to do is \dt or \c x. It's so much better. Can't remember them? Just do \?.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by realusername on Thursday June 18, 2015 @09:44AM (#9738440)
That's also the problem I have, \dt,\c just don't make sense at all and I never remember them whereas 'SHOW TABLES' does not even need explanations. It's also the same thing with the unix users, I never fully understood how postgres handles user permissions. I would say that Postgres itself is really really good but the tooling around is just not there yet.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by noir_lord on Thursday June 18, 2015 @10:33AM (#9738715)
I just remembered it as \d as display and \dt as display tables.

I often invent mnemonics that only mean something to me until muscle memory kicks in.

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by bshimmin on Thursday June 18, 2015 @10:41AM (#9738778)
Here's a nice one-page cheat sheet, of which about 75% you will probably never need to use: http://www.postgresonline.com/downloads/special_feature/post...
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by noir_lord on Thursday June 18, 2015 @01:43PM (#9740372)
Thats excellent, thanks :).
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by collyw on Thursday June 18, 2015 @10:07AM (#9738559)
Thats like trying to say emacs is easier than eclipse. Sure it may be more efficient once you are used to it, but its not more intuitive.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by baq on Thursday June 18, 2015 @11:03AM (#9738955)
eclipse and intuitive shouldn't ever be used in the same sentence. emacs ditto, but calling one more intuitive from another is missing the point by about 1 AU.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by collyw on Thursday June 18, 2015 @03:58PM (#9741242)
Eclipse isn't great in that respect, but choosing something from a menu is definitely more intuitive than remembering the cryptic commands in emacs.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by semi-extrinsic on Thursday June 18, 2015 @07:01PM (#9742101)
"The only intuitive interface is the nipple, after that it's all learned." - Bruce Ediger
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by collyw on Friday June 19, 2015 @04:07AM (#9743527)
Sure but a menu is still more intuitive than C-c.

(I even had to check the fact that C- is the ctrl key when looking up this command. I noticed commands listed as M-w - I have no idea what keys that represents).

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by dllthomas on Friday June 19, 2015 @04:20AM (#9743563)
M is short for Meta, and usually means "Alt".
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by neokya on Thursday June 18, 2015 @10:39AM (#9738758)
\? is killer.

Thanks a ton, I didn't know that yet. I also find MySQL cli very easy to work. But that's going to change now, it seems.

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by pmontra on Thursday June 18, 2015 @10:35AM (#9738732)
Show create table was so awkward to me after years of \d table. I remember I had to google even desc table and show databases :-)

Anyway, you might want to check http://pgcli.com/ for a free alternative cli with completion. I started using it over the standard psql and I recommend it to everybody.

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by brightball on Thursday June 18, 2015 @09:27AM (#9738349)
Admittedly, I haven't used the PG or MySQL cli in years. Coughed up money for a Navicat Premium license about 5 years ago and never looked back.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by neverminder on Thursday June 18, 2015 @09:32AM (#9738378)
You should also check out https://www.jetbrains.com/dbe/
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by jsmeaton on Thursday June 18, 2015 @09:43AM (#9738435)
I'm fairly sure I signed up for the early access program months ago and still haven't heard back. It's possible that I meant to and didn't though.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by payamb on Thursday June 18, 2015 @09:54AM (#9738483)
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by cwyers on Thursday June 18, 2015 @10:26AM (#9738673)
> It is important to distinguish EAP from traditional pre-release software. Please note that the quality of EAP versions may at times be way below even usual beta standards.

That... scares me, more than a little. I'm okay with it crashing, or losing queries I wrote. I really want failure cases to be restricted to NOT affecting the database, though. I'll probably stay away or try it out on my personal machine on a toy database for now.

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by jkestner on Thursday June 18, 2015 @09:49AM (#9738459)
Same here. I muddled along with pgAdmin for a while, but now use Valentina Studio. Excellent free app (has an in-app purchase for some advanced features but doesn't feel crippled at all).
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by dolel13 on Thursday June 18, 2015 @10:56AM (#9738899)
Same here. The Valentina Studio free app is very helpful and somewhat smoothens the learning curve
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by noir_lord on Thursday June 18, 2015 @10:32AM (#9738707)
If you haven't already checkout pgadmin-3, I mostly live in the cli but if I need to do something complex or write a large query I often jump into pgadmin as it's display and proper editor are excellent!.

Prefer it to MySQL Workbench even which I liked.

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by knodi123 on Thursday June 18, 2015 @10:36AM (#9738733)
I've recently made the switch to postgres, and then I found pgadmin3, and I'm really feeling some pain.

For instance, the "explain query" visualization is great, and very helpful, but there's no way I can find to zoom out, at all. And that window doesn't support mouse scrolling. And there's no way to export the visualization somewhere else. So when I'm trying to figure out why a very, very large query is running slowly, it's agony to use pgadmin3.

Do you know any good postgres query analysis tools?

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by bmdavi3 on Thursday June 18, 2015 @11:27AM (#9739158)
It's not graphical, but pasting the explain analyze output into http://explain.depesz.com/ helps me see where postgres is spending most of its time.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by knodi123 on Thursday June 18, 2015 @06:06PM (#9741910)
That's a bit of a help, thanks!
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by marcosdumay on Thursday June 18, 2015 @10:53AM (#9738877)
Count another vote for the pgadmin.

I hate the backslash commands of postgres, about as much as I hate the show commands of mysql (what's not nearly as much as I hate the oracle introspection tools).

Why couldn't SQL standardize database introspection?

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by baq on Thursday June 18, 2015 @11:01AM (#9738941)
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by marcosdumay on Thursday June 18, 2015 @08:41PM (#9742441)
I didn't know it was a standard, nor that it was widely supported.

Thanks.

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by WorldWideWayne on Thursday June 18, 2015 @11:10AM (#9739010)
This whole thread makes me happy to be a SQL Server user, where the UI tools are standard and robust.

90% of the time, I don't need to remember any special commands for introspecting and since it's on Windows - I can use the keyboard to navigate the entire UI with ease. When I write SQL, I get glorious Intellisense (that's autocomplete to you) for every single object (edit: and command) in the db.

Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by kaolinite on Friday June 19, 2015 @05:10AM (#9743708)
I have no idea how they compare but the open-source databases has proprietary database tools too, such as Navicat, which have auto-complete, a good UI (Navicat is hardly beautiful but it works well), etc. There are a few other options too.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by jqm on Thursday June 18, 2015 @11:08PM (#9742807)
I don't know why you are getting downvoted. I'm not personally crazy about SQL Server, but a lot of big companies are. In this situation some of us find ourselves in from time to time, SQL Management Studio is pretty handy.
Re:“Fashion Is Hard. PostgreSQL Is Easy” [video] by allendoerfer on Thursday June 18, 2015 @09:04AM (#9738239)
I have the same problem. Because of this I use PostgreSQL only if I need it feature-wise and use MySQL as the default. This of course prevents me from getting used to PostgreSQL.