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

Update GMS to detect INSERT statements with row alias and return error. #2463

Merged
merged 7 commits into from
Apr 16, 2024

Conversation

nicktobey
Copy link
Contributor

We parse these statements but don't yet support them. So for now we return a helpful error.

@nicktobey nicktobey force-pushed the nicktobey/insert-as branch from 8509d99 to d10c2b4 Compare April 16, 2024 20:14
Copy link
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just one request for the commented out tests. A skipped test or changing them to the new error message would be preferable, just so they aren't so hard to find again in the future.

Comment on lines 479 to 492
/* Disabled, see https://github.com/dolthub/dolt/issues/7638
{
WriteQuery: "INSERT INTO mytable (i,s) values (1, 'hi') AS dt(new_i,new_s) ON DUPLICATE KEY UPDATE s=new_s",
ExpectedWriteResult: []sql.Row{{types.NewOkResult(2)}},
SelectQuery: "SELECT * FROM mytable WHERE i = 1",
ExpectedSelect: []sql.Row{{int64(1), "hi"}},
},
{
WriteQuery: "INSERT INTO mytable (i,s) values (1, 'hi') AS dt ON DUPLICATE KEY UPDATE mytable.s=dt.s",
ExpectedWriteResult: []sql.Row{{types.NewOkResult(2)}},
SelectQuery: "SELECT * FROM mytable WHERE i = 1",
ExpectedSelect: []sql.Row{{int64(1), "hir"}},
},
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these the new "insert row aliases are not currently supported" error cases? Can we leave them in and assert they return the new error message? That would be a little better than commenting them out. Alternatively, you could add them as skipped tests somewhere – we do track those skipped tests (James has been doing that lately) so at least they are still visible that way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a Skip flag to this test type. How does this look?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipped tests look great. Looks like there is a compile error coming from dbr being unknown now though.

@nicktobey nicktobey force-pushed the nicktobey/insert-as branch from c153637 to cac5222 Compare April 16, 2024 20:51
@nicktobey nicktobey force-pushed the nicktobey/insert-as branch from 62ffbc9 to 91a37eb Compare April 16, 2024 21:14
@nicktobey nicktobey merged commit cf70da4 into main Apr 16, 2024
7 checks passed
@nicktobey nicktobey deleted the nicktobey/insert-as branch April 16, 2024 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants