Skip to content

Mismatch in primary key types should not cause a failure on SQL writing #87

@OriHoch

Description

@OriHoch

reproduction

  • table schema:
{"fields": [
    {"name": "id", "type": "integer"},
    {"name": "date", "type": "string"}
],
"primaryKey": ["id"]
  • write some rows to a PostgreSQL DB - but in the rows, have the id as type string (but numeric)
  • data in DB is inserted correctly, and DB converts it to integer
  • now, write the same rows again

expected

  • provide an error message, warning about type mismatch
  • or match rows in DB (as opposed to bloom)

actual

  • writer.__prepare_bloom - collects all data as integers
  • writer.__check_existing - compares with a string id - which doesn't match
  • this causes insert
  • when inserting, the DB matches the primary key (even though types don't match)
  • error about duplicate key

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions