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

Invalid sql generated #1141

Closed
weiznich opened this Issue Sep 2, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@weiznich
Contributor

weiznich commented Sep 2, 2017

Setup

Versions

  • Rust:
  • Diesel:
  • Database:
  • Operating System

Feature Flags

  • diesel:
  • diesel_codegen:

Problem Description

It is possible to generate invalid sql using diesels buildin query dsl. In detail it is possible to use desc() in group_by calls. (I didn't check any other combinations, probably this could be used in other places too)

What are you trying to accomplish?

I've misstyped some query by accident using group_by instead of order and was surprised this was compiling after noticing this.

What is the expected output?

A compiler error indicating .desc() should not be used in group_by() clauses.

What is the actual output?

A runtime error indicating a invalid sql query

Are you seeing any additional errors?

No

Steps to reproduce

some_table::table.group_by(some_table::some_column.desc()).load(conn)?;

Checklist

  • I have already looked over the issue tracker for similar issues.

@killercup killercup added the bug label Sep 2, 2017

@sgrif

This comment has been minimized.

Member

sgrif commented Sep 5, 2017

group_by is not part of our public API. It has no expected behavior.

// This test is a shim for a feature which is not sufficiently implemented. It
// has been added as we have a user who needs a reasonable workaround, but this
// functionality will change and this test is allowed to change post-1.0

@sgrif sgrif closed this Sep 5, 2017

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