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

Insertable structs with missing fields should cause compile-time error #599

Closed
Boscop opened this Issue Jan 31, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@Boscop

Boscop commented Jan 31, 2017

When I have an Insertable struct that is missing fields for columns of the table that are NOT NULL and have no default value, it still compiles fine.
I think it would be nice if it caused an error at compile-time.

@sgrif

This comment has been minimized.

Member

sgrif commented Feb 1, 2017

This is a (very) long term goal. I think this is more likely to end up being a lint than a hard error, as actually representing this in the type system is likely impossible unless we have some form of anonymous struct/record.

@sgrif

This comment has been minimized.

Member

sgrif commented Dec 16, 2017

This is no longer a goal of the project. Properly supporting this would require not just know about the type and default of the column, but also any triggers that could fire. If we were truly to support this we would also need to care about constraints as well.

Ultimately the revised goal of the project is to prevent all errors on select statements at compile time, and many classes of errors on insert/update, but not all.

@sgrif sgrif closed this Dec 16, 2017

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