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

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

Open
OriHoch opened this issue Aug 6, 2017 · 2 comments
Open
Labels

Comments

@OriHoch
Copy link

OriHoch commented Aug 6, 2017

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
@OriHoch
Copy link
Author

OriHoch commented Aug 6, 2017

@roll
Copy link
Member

roll commented Aug 9, 2017

Thank for reporting @OriHoch (cc @akariv)

@roll roll changed the title writer: mismatch in primary key types should not cause failure (or provide helpful error) Mismatch in primary key types causes a failure on writing Sep 4, 2017
@roll roll changed the title Mismatch in primary key types causes a failure on writing Mismatch in primary key types should not cause a failure on writing Sep 4, 2017
@roll roll closed this as completed Apr 6, 2020
@roll roll reopened this Apr 6, 2020
@roll roll transferred this issue from frictionlessdata/tableschema-sql-py Sep 21, 2020
@roll roll changed the title Mismatch in primary key types should not cause a failure on writing Mismatch in primary key types should not cause a failure on SQL writing Sep 21, 2020
@roll roll transferred this issue from frictionlessdata/frictionless-py Sep 26, 2020
@roll roll added the bug label Sep 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants