Skip to content
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

[diesel] CTE should reference columns explicitly #210

Open
Tracked by #4189
smklein opened this issue Sep 1, 2021 · 0 comments
Open
Tracked by #4189

[diesel] CTE should reference columns explicitly #210

smklein opened this issue Sep 1, 2021 · 0 comments
Labels
database Related to database access

Comments

@smklein
Copy link
Collaborator

smklein commented Sep 1, 2021

(Follow-up from #192)

Within the CTE implementation in db/update_and_check.rs, we use the statement RETURNING * to extract the results of the
UPDATE subquery. Additionally, when selecting from the JOIN of the SELECT and UPDATE queries, we access found.* to wild-card access the found structure.

This works, but isn't the best for backwards compatibility. If we add a column to the DB, but still run the old version of software, this risks bumping into migration issues - we'll accidentally read "more columns than we know how to parse".

In contrast, nearly all native Diesel operations select on columns explicitly. Using the traits provided within Diesel, it should be possible to do the same for this CTE, and would protect against these migration issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Related to database access
Projects
None yet
Development

No branches or pull requests

1 participant