News for hackers. Stuff that matters.
Re:What I Wish Someone Told Me About Postgres by cyanydeez on Tuesday November 12, 2024 @07:32AM (#42115012)
I'd say I tend to ignore the standard docs because they rarely have examples and rely on the arcane procedure of trying to decipher the super command options with all it's "[OR THIS|THAT]".

I assume _someone_ can read this pseudo programming, but it's not me.

Re:What I Wish Someone Told Me About Postgres by PhilippGille on Tuesday November 12, 2024 @08:14AM (#42115222)
I love the diagrams from the SQLite documentation: https://www.sqlite.org/syntaxdiagrams.html
Re:What I Wish Someone Told Me About Postgres by christophilus on Tuesday November 12, 2024 @12:58PM (#42117916)
SQLite diagrams plus examples are pretty much the way I wish all of my documentation worked.
Re:What I Wish Someone Told Me About Postgres by o11c on Tuesday November 12, 2024 @01:04PM (#42117975)
I've been bitten by those before because they are not generated from the actual syntax-parsing code, and thus are sometimes out of sync and wrong (or at least misleading).
Re:What I Wish Someone Told Me About Postgres by teddyh on Tuesday November 12, 2024 @02:50PM (#42119000)
Those are commonly called “railroad diagrams”: <https://en.wikipedia.org/w/index.php?title=Syntax_diagram&ol...>
Re:What I Wish Someone Told Me About Postgres by paulryanrogers on Tuesday November 12, 2024 @07:59AM (#42115148)
Sometimes I find it annoying but mostly it works well for me. I've come to embrace the find feature and visually scanning over any parenthetical stuff.

The alternative is they have to break it up into several quasi examples, each with their own optional modifiers.

Re:What I Wish Someone Told Me About Postgres by Clubber on Tuesday November 12, 2024 @07:34AM (#42115022)
FWIW square brackets indicate an optional parameter and the pipe inside indicates all the parameters available; but I agree, I don't particularly care for that notation and prefer actual running SQL examples.
Re:What I Wish Someone Told Me About Postgres by hobs on Tuesday November 12, 2024 @12:26PM (#42117562)
Railroad-esque diagrams can be weird but they say a lot in a very short space, I would highly recommend spending a little extra time working on thinking through them, they are everywhere!
Re:What I Wish Someone Told Me About Postgres by Clubber on Tuesday November 12, 2024 @03:27PM (#42119382)
>Railroad-esque diagrams

Now and forever I will think of railroads when I see these.

Re:What I Wish Someone Told Me About Postgres by hobs on Tuesday November 12, 2024 @04:39PM (#42120003)
Well, you should! But, I didn't invent anything there, that's what they are named :)

Syntax diagrams (or railroad diagrams) are a way to represent a context-free grammar. They represent a graphical alternative to Backus–Naur form, EBNF, Augmented Backus–Naur form, and other text-based grammars as metalanguages... https://en.wikipedia.org/wiki/Syntax_diagram

Re:What I Wish Someone Told Me About Postgres by assbuttbuttass on Tuesday November 12, 2024 @08:30AM (#42115319)
I'm looking at the postgres docs now, and they certainly have the arcane formal syntax definitions, but they also have plenty of useful examples https://www.postgresql.org/docs/current/sql-altertable.html#...
Re:What I Wish Someone Told Me About Postgres by smartbit on Tuesday November 12, 2024 @10:56AM (#42116567)
PostgreSQL Administration Cookbook series served me well

https://www.oreilly.com/library/view/postgresql-16-administr...

Re:What I Wish Someone Told Me About Postgres by mustime on Wednesday November 13, 2024 @05:08AM (#42124671)
For real-world SQL examples and generating queries fast, you might like https://ai2sql.io/ . It's an AI-based tool that lets you enter natural language prompts and outputs efficient SQL code tailored to your needs.