Skip to content

Selection->getPrimary() is not sufficiently specific #100

@temistokles

Description

@temistokles

Selection->getPrimary returns name of primary key (in my case id for all the tables).

This is also true when joining tables - e.g. with where table2.column = ?.

Unfortunatelly when joining very large tables (hundreads of thousands of rows, hundread columns) the order of returned columns is indeterminate in MySQL. Although observed here, this might not be the only case when this happens.

The resulting behaviour is the primary key from table2 is considered instead of table1. This has fatal results - not all the rows are returned and they might get damaged when being updated.

The easy way to fix this seemed to be:

  1. not using PKs in Statement->execute, unfortunatelly this breaks referencing (row->table2->table2row).
  2. just using <table name>.id instead of just id in Selection->getPrimary, but this breaks referencing as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions