Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INSERT diagram isn't intuitive #5396

Open
jseldess opened this issue Sep 10, 2019 · 7 comments
Open

INSERT diagram isn't intuitive #5396

jseldess opened this issue Sep 10, 2019 · 7 comments

Comments

@jseldess
Copy link
Contributor

jseldess commented Sep 10, 2019

Jesse Seldess (jseldess) commented:

On Slack, @darinpp mentioned:

Hi Jesse. I was just looking at this https://www.cockroachlabs.com/docs/stable/insert.html and it doesn't seem to be showing the insert into ... values(...) syntax in the BNF diagram. Am I missing something? For Postgress for example - https://www.postgresql.org/docs/11/sql-insert.html - they show first the default values (which we have), then values (which I can't see) and then the query.

I think the diagram using select_stmt to represent various types of “selection clauses", including VALUES. The link to https://www.cockroachlabs.com/docs/stable/selection-queries.html in the select_stmt parameter description suggests as much.

However, I very much agree with @darinpp that the diagram isn't friendly or intuitive. It should help users understand the statement syntax, as they most often use it, without having to dig deep and bounce around. We should revisit this and find a way to make the diagram express the most common cases, including VALUES.

cc: @knz, who was involved in the way we documented "selection clauses". @rmloveland, @ericharmeling, not sure which of you wants to take this. Not sure if this is p1 or p2.

Jira Issue: DOC-322

@knz
Copy link
Contributor

knz commented Sep 10, 2019

It seems reasonable to me to present both the general form (the one currently presented) and then underneath in sub-sections expand the select_stmt clause into 3+ example diagrams including the one that mentions VALUES.

@ericharmeling ericharmeling self-assigned this Sep 10, 2019
@ericharmeling
Copy link
Contributor

I agree with @knz ... We do this for a few other SQL statements (e.g. CREATE TABLE, with "Basic" and "Expanded" diagrams)

@darinpp
Copy link

darinpp commented Sep 10, 2019

The VALUES is not a general use select statement. It would make sense to have it expanded as part of defining the INSERT. The easiest to understand in my mind is the approach that MySQL has - https://dev.mysql.com/doc/refman/8.0/en/insert.html
It shows separately each of the variants.

@knz
Copy link
Contributor

knz commented Sep 10, 2019

The VALUES is not a general use select statement.

In fact, it is. The full generality of selection queries is available to INSERT -- this is a pg feature, which MySQL does not have.

Conversely all 3 selection clauses (TABLE, VALUES and SELECT) are valid top-level statements.

@darinpp
Copy link

darinpp commented Sep 10, 2019

You are right. I didn't know that. Everything is good then.

@jseldess jseldess added this to the 20.1 milestone Sep 11, 2019
@jseldess
Copy link
Contributor Author

Not sure if we'll have the bandwidth to update this for 19.2, so putting under 20.1.

@ericharmeling ericharmeling added the P-2 Normal priority; secondary task label Jul 15, 2020
@rmloveland rmloveland added P-3 Low priority; nice-to-have and removed P-2 Normal priority; secondary task labels Jan 7, 2021
@jseldess jseldess removed this from the 20.1 milestone May 25, 2021
@jseldess jseldess removed the G-sql label Jan 18, 2022
@github-actions
Copy link

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
10 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB docs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants