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

Build examples/mysql/getting_started_step_1 failed with rustc 1.18.0 #987

Closed
ohmountain opened this Issue Jul 2, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@ohmountain

ohmountain commented Jul 2, 2017

Hi there, I got a problem when i run the mysql example.

Setup

[dependencies]
diesel = { version = "0.13.0", features = ["mysql"] }
diesel_codegen = { version = "0.13.0", features = ["mysql"] }
dotenv = "0.9.0"

Versions

  • Rust:
    rustc 1.18.0 (03fc9d622 2017-06-06)
  • Diesel:
    0.13.0
  • Database:
    mysql Ver 14.14 Distrib 5.7.18, for Linux (x86_64) using EditLine wrapper
  • Operating System
    Ubuntu 16.04 4.4.0-83-generic

Feature Flags

  • diesel:
    mysql
  • diesel_codegen:
    mysql

Error message

error: expected identifier, found keyword `type`
 --> src/schema.rs:1:1
  |
1 | infer_schema!("dotenv:DATABASE_URL");
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in a macro outside of the current crate

error: expected identifier, found keyword `type`
 --> src/schema.rs:1:1
  |
1 | infer_schema!("dotenv:DATABASE_URL");
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in a macro outside of the current crate

error: aborting due to 2 previous errors

error: Could not compile `diesel_demo_step_1_mysql`.

How to resolve this ?
Thanks!

@sgrif

This comment has been minimized.

Member

sgrif commented Jul 4, 2017

We don't support columns which have the same name as keywords in Rust (type being the most common case). You'll need to rename the column, or use the table! macro manually (you can generate it with diesel infer-schema) and omit that column.

@sgrif sgrif closed this Jul 4, 2017

@ohmountain

This comment has been minimized.

ohmountain commented Jul 4, 2017

@sgrif 😹😹😹😹😹,thank you !

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