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

Renaming the primary key of a table blows everything up #436

Open
sgrif opened this Issue Sep 12, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@sgrif
Member

sgrif commented Sep 12, 2016

A project with the following migration would fail to compile when using infer_schema!

CREATE TABLE users (non_standard_pk SERIAL PRIMARY KEY);
ALTER TABLE users RENAME COLUMN non_standard_pk TO id;

While the column has been renamed, the pg_attribute entry that the index is pointing to continues to have the old name. This causes our generated code to explode when we do type PrimaryKey = users::non_standard_pk. I haven't looked too deeply into this. My guess is that there is some indicator on the pg_attribute entry which will indicate that it's no longer being directly used, and the new entry is somehow referencing the old one.

@sgrif

This comment has been minimized.

Member

sgrif commented Sep 12, 2016

Probably worth mentioning that the value of attisdropped on the entry with the wrong name is 'f'

@Eijebong

This comment has been minimized.

Member

Eijebong commented May 25, 2017

I tried it and can't reproduce. Has this been fixed and the issue forgotten ? Maybe postgres has been fixed ?

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