Skip to content

[diesel] CTE should reference columns explicitly #210

@smklein

Description

@smklein

(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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    databaseRelated to database access

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions