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

Changed column names in `table!` don't make it to `joinable!` #1609

Open
toddobryan opened this Issue Apr 1, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@toddobryan

toddobryan commented Apr 1, 2018

Setup

Latest version

Problem Description

Using print-schema on a pre-existing database, columns named type are correctly changed to type_ with a #[sql_name = "type"] attribute, but the underscore is not added in the joinable! macro later, leading to errors.

Checklist

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

@sgrif sgrif changed the title from Changed column names in `!table` don't make it to `joinable!` to Changed column names in `table!` don't make it to `joinable!` Apr 1, 2018

@meven

This comment has been minimized.

meven commented Jun 16, 2018

I would like to claim this issue.

I understand the issue at stake is that in print_schema.rs:250 the outputed foreign_key column does not pass through the RESERVED_NAMES filter in inference.rs.

So I wonder which way to go from there, the simplest way I can come up with is to swap in

            writeln!(f, "{}", Joinable(foreign_key))?;

the foreign_key with the rust_name using tables: Vec<TableData> to find the ColumnDefinition and the rust_name.

Or in inference.rs there could be a post process in load_foreign_key_constraints to apply the RESERVED_NAMES filter or foreign keys as it is done on primary keys line 147.

@meven

This comment has been minimized.

meven commented Jun 27, 2018

ping @Eijebong does my take make sense ?
Should I propose a fix, right away ?

@meven

This comment has been minimized.

meven commented Jul 16, 2018

ping @Eijebong
I would like to claim this issue, does this mentoring offer still stands ?
I'd like to discuss a little design, but after that I should be able to make a pull request with tests.

@Eijebong

This comment has been minimized.

Member

Eijebong commented Jul 17, 2018

Sure, go for it. If you need help we can either discuss it here or on our gitter channel (sorry missed the other ping)

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