Skip to content

Nudge towards specifying a proper key #22

Description

@JasperSch

The default for the 'key' argument is all columns of the table (e.g. assumption of unique rows).

This is a nice default, but is often less efficient versus actually getting the key (=minimal set of columns) from the user.
With this, deletes and updates require less columns to match on and databases use indices better.

This is especially important because in case of some data types, matching can go wrong.
E.g. sometimes numbers or timestamps do not properly match because of different precision.
editbl however wrongly throws a 'succes' in these cases, because the database doesn't give an error and there's no additional check on whether or not the data actually got deleted or updated.

A combination of the following needs to be implemented:

  1. Warning or message in case 'key' argument is not used.
  2. Adjust e_rows_update / e_rows_delete to support more data types correctly
    -> If not resolvable, throw an error in case one of the columns of the key contain a datatype which is known to cause problems.
  3. Request the amount of deleted rows / updates back from the database and throw error or warning in case of mismatch.
    -> Not all backends will support this. Also, this can cause confusion if there were concurrent updates or deletes.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions