Enhance various statements and diagrams#2762
Conversation
0938462 to
f05055a
Compare
f05055a to
a31ffdf
Compare
a31ffdf to
1259d3f
Compare
5a2a6ab to
bc2ca99
Compare
37d7fb9 to
f23efd1
Compare
f23efd1 to
be80969
Compare
be80969 to
27213f9
Compare
27213f9 to
96adf10
Compare
96adf10 to
790a73d
Compare
|
@jseldess please check the PR description for suggestions on how to review this. I suggest we spend our scheduled time together later this week to do a live review. |
|
Review status: 0 of 70 files reviewed at latest revision, 8 unresolved discussions, all commit checks successful. v2.0/common-table-expressions.md, line 22 at r2 (raw file): Previously, rmloveland (Rich Loveland) wrote…
Thanks, @knz and @rmloveland. There are some strange edge cases where we've only been able to get the markdown to convert properly by using v2.0/common-table-expressions.md, line 56 at r2 (raw file): Previously, knz (kena) wrote…
Thanks for the context. We should definitely include conventions around multi-line sql samples in the style guide that @lhirata will be driving in the 2.1 release cycle. Lauren, please use Raphael as a resource for that. v2.0/relational-expressions.md, line 13 at r1 (raw file): Previously, jseldess (Jesse Seldess) wrote…
@knz, you didn't respond this comment, so if there's time, we can discuss in our meeting today. This is a nit, really, and not something that needs to be done now. v2.0/select-clause.md, line 86 at r1 (raw file): Previously, knz (kena) wrote…
Thanks, @knz, and apologies for the current inconsistencies across our docs. As mentioned elsewhere, we're going to work out more thorough style guidelines/conventions in the 2.1 cycle. v2.0/selection-clauses.md, line 114 at r1 (raw file): Previously, knz (kena) wrote…
Yeah, this is pure preference. Both forms are correct, though the hyphenated form is more widely used, I think. v2.0/subqueries.md, line 29 at r1 (raw file): Previously, knz (kena) wrote…
In a lot of cases, you have just left-aligned all lines but the first, so I'm not really clear on when you do that vs. indent. But this is not worth a lot of time right now. Comments from Reviewable |
| title: Simple SELECT Clause | ||
| summary: The Simple SELECT clause loads or computes data from various sources. | ||
| toc: false | ||
| redirect-from: select.html |
There was a problem hiding this comment.
One more field to add to the front-matter to make our version switcher work between 1.1 and 2.0:
key: select.html
| summary: Scalar expressions allow the computation of new values from basic parts. | ||
| toc: false | ||
| redirect-from: sql-expressions.html | ||
| --- |
There was a problem hiding this comment.
One more field to add to get our version selector to work between 1.1 and 2.0:
key: sql-expressions.html
|
Comments from Reviewable |
c1e5a73 to
4efd6ca
Compare
|
Improved, RFA(hopefully last)L Review status: 0 of 70 files reviewed at latest revision, 10 unresolved discussions. v2.0/common-table-expressions.md, line 22 at r2 (raw file): Previously, jseldess (Jesse Seldess) wrote…
Will follow up in #2819. v2.0/common-table-expressions.md, line 56 at r2 (raw file): Previously, jseldess (Jesse Seldess) wrote…
Let's possibly follow up in #2819 too. v2.0/select-clause.md, line 5 at r3 (raw file): Previously, jseldess (Jesse Seldess) wrote…
Done. v2.0/relational-expressions.md, line 13 at r1 (raw file): Previously, jseldess (Jesse Seldess) wrote…
I have reworked this page and changed the intro to condense it to its bare essentials. I think the result is more clear this way. v2.0/scalar-expressions.md, line 6 at r3 (raw file): Previously, jseldess (Jesse Seldess) wrote…
Done. Comments from Reviewable |
4efd6ca to
5e99890
Compare
|
Thank you for iterating, @knz. I'm now concerned about the proliferation of terms we use to refer to the same thing: More broadly, on further review and consideration, I have to admit that I'm still confused and a bit concerned about this level of abstraction. I think, if we wanted to keep things simpler, we could get away with covering these semantics just on the selection clauses page, given the definition of statement-like queries as "a group one or more selection clause with set operations". But it is late in the game to request such a change, and we do need to merge soon, so I'm ok holding off and looping other people in for perspective post-2.0 release. Comments from Reviewable |
5e99890 to
2d6815c
Compare
|
Jesse, thanks for the feedback. I agree with it and I am glad that we could get other more superficial issues out of the way earlier in the review process to reveal the more important issues. I have decided to collapse the pages on set operations, selection clauses and relational expressions into a single page "selection queries". I think this term is both suitably general, simple and accurate. Let me know what you think. Review status: 0 of 71 files reviewed at latest revision, 10 unresolved discussions. Comments from Reviewable |
251189a to
16b5ff4
Compare
|
This LGTM! Just a few final nits. Thank you for putting in so much time and effort. Review status: 0 of 70 files reviewed at latest revision, 10 unresolved discussions, all commit checks successful. v2.0/selection-queries.md, line 11 at r4 (raw file):
one or more selection clauses v2.0/selection-queries.md, line 15 at r4 (raw file):
Let's use Comments from Reviewable |
**tl;dr**: fix confusion, better document joins, fix upsert/delete/insert/update. Prior to this patch, the documentation was confusing "SELECT statements" and "selection clauses". This confusion was most visible in the documentation for INSERT and UPSERT, which incorrectly specified that these statements take a selection clause as operand, whereas they support much more than that. The documentation was also incorrectly listing set operations (EXCEPT/UNION etc) as operators of SELECT in particular, whereas they actually work also with any selection clause. The root cause of this sorry state of affairs was caused by a single misconception: there is really no such thing as a "SELECT statement" in the SQL grammar; instead there are various relational expressions and operators, and selection clauses are just a particular instance of relational expressions. This patch enhances this situation as follows: - The page about a "SELECT statement" is deleted. It is replaced by a page titled "Simple SELECT clause", to properly highlight it is merely an instance of a selection clause (albeit with a reminder that it happens to also be valid as standalone statement). - To ensure the basic SELECT syntax remains the "main SELECT doc page" for newcomers, the top-level links in navigation for the `SELECT` keyword are changed to point to the page on the simple SELECT clause. - A new page "Statement-Like Relational Expressions" is introduced, which explains properly what can become a subquery. The pages about other statements that require a statement-like query are modified to point to this new page. - The difference between "table expressions", "selection clauses" and "statement-like queries" is repeatedly clarified in numerous places, to ensure that clarity is pervasively maintained throughout the docs. Additionally, the syntax diagrams for all these constructs are updated to more accurately reflect reality. Some more documentation for the various `JOIN` operators is added, as well as for subqueries. The term "value expression" is removed in favor of the more correct "scalar expression". To review this patch, the reviewer is invited to first proceed in a holistic manner and navigate the result of the changes with the eyes of a newcomer: 1. Land on the "Simple SELECT clause" page; ensure that it makes sense, including its simplified syntax diagram. 2. Check out the page on "Table Expressions", which documents what can fit in the FROM clause of a simple SELECT clause. Check that it makes sense, including the new syntax diagrams. 3. Check the new page on "Join Expressions". Check that it makes sense, including the new syntax diagrams and "performance best practices". 4. Check the docs for INSERT/UPDATE/UPSERT/DELETE and check they make sense, including the new syntax diagrams. 5. Navigate to the page on "Relational Expressions" and check that it makes sense, including the new syntax diagrams. 6. Review the new page "Limiting Query Results" linked from there. 7. Check The new page "Subqueries". Once the reviewer satisfies themselves that the relationship between the pages and the syntax diagrams make sense, the line-by-line diff can be reviewed for further edits.
16b5ff4 to
dc60e25
Compare
|
Review status: 0 of 70 files reviewed at latest revision, 12 unresolved discussions, all commit checks successful. v2.0/selection-queries.md, line 11 at r4 (raw file): Previously, jseldess (Jesse Seldess) wrote…
Done. v2.0/selection-queries.md, line 15 at r4 (raw file): Previously, jseldess (Jesse Seldess) wrote…
Done. Comments from Reviewable |
|
Ok fixed. I surmise we can merge this now? |
|
Yes. Thank you, @knz! |
Fixes #2719.
Fixes #2519.
Fixes #2182.
Fixes #2221.
Fixes #2350.
Fixes #2797.
First step towards fixing #534.
tl;dr: fix confusion, better document joins, fix upsert/delete/insert/update.
Prior to this patch, the documentation was confusing "SELECT
statements" and "selection clauses". This confusion was most visible in the documentation for INSERT and UPSERT, which incorrectly specified that these statements take a selection clause as operand, whereas they support much more than that.
The documentation was also incorrectly listing set operations (EXCEPT/UNION etc) as operators of SELECT in particular, whereas they actually work also with any selection clause.
The root cause of this sorry state of affairs was caused by a single
misconception: there is really no such thing as a "SELECT statement"
in the SQL grammar; instead there are various relational expressions
and operators, and selection clauses are just a particular instance of relational expressions.
This patch enhances this situation as follows:
The page about a "SELECT statement" is deleted. It is replaced by a
page titled "Simple SELECT clause", to properly highlight it is
merely an instance of a selection clause (albeit with a reminder
that it happens to also be valid as standalone statement).
To ensure the basic SELECT syntax remains the "main SELECT doc page"
for newcomers, the top-level links in navigation for the
SELECTkeyword are changed to point to the page on the simple SELECT
clause.
A new page "Relational Expressions" is introduced, which explains
properly the concept of "Statement-like Query". The pages about
other statements that require a statement-like query are modified to
point to this new page.
The difference between "table expressions", "selection clauses" and
"statement-like queries" is repeatedly clarified in numerous places,
to ensure that clarity is pervasively maintained throughout the
docs.
Additionally, the syntax diagrams for all these constructs are updated to more accurately reflect reality. Some more documentation for the various
JOINoperators is added.To review this patch, the reviewer is invited to first proceed in a
holistic manner and navigate the result of the changes with the eyes
of a newcomer:
Land on the "Simple SELECT clause" page; ensure that it makes
sense, including its simplified syntax diagram.
Check out the page on "Table Expressions", which documents what can
fit in the FROM clause of a simple SELECT clause. Check that it
makes sense, including the new syntax diagrams.
Check the docs for INSERT/UPDATE/UPSERT/DELETE and check they make
sense, including the new syntax diagrams.
Navigate to the page on "Relational Expressions" and check that it
makes sense, including the new syntax diagrams.
Review the new page "Limiting Query Results" linked from there.
Once the reviewer satisfies themselves that the relationship between
the pages and the syntax diagrams make sense, the line-by-line diff
can be reviewed for further edits.