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

Non-ambiguous ORDER BY col should not error #2091

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

max-hoffman
Copy link
Contributor

No description provided.

@@ -41,10 +41,23 @@ type planTest struct {

func TestPlanBuilder(t *testing.T) {
var verbose, rewrite bool
//verbose = true
//rewrite = true
verbose = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Revert these.

@@ -45,6 +45,19 @@ func TestPlanBuilder(t *testing.T) {
//rewrite = true

var tests = []planTest{
{
Copy link
Contributor

Choose a reason for hiding this comment

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

This apparently works in MySQL

select t1.x as x, t1.x as x from xy t1, xy t2 order by x;

but this fails in MySQL

select t1.x as x, t2.x as x from xy t1, xy t2 order by x;

I think they both fail in dolt even with your fix.

Also should make sure

select x, y as x from xy order by x;

still fails

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, take another peek see if the solution's OK

Copy link
Contributor

Choose a reason for hiding this comment

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

I previously outlined the exact resolution rules for ORDER BY in MySQL here: dolthub/dolt#6676

@max-hoffman max-hoffman force-pushed the max/order-by-ambiguity-bug branch from e4cddae to 86deb33 Compare October 20, 2023 19:04
Copy link
Contributor

@jycor jycor left a comment

Choose a reason for hiding this comment

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

LGTM

@max-hoffman max-hoffman merged commit 724edc9 into main Oct 20, 2023
6 checks passed
@max-hoffman max-hoffman deleted the max/order-by-ambiguity-bug branch October 20, 2023 20:00
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.

4 participants