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

Update multiple fields. One field not updated sometimes #6076

Closed
HarryC004 opened this issue May 21, 2024 · 0 comments
Closed

Update multiple fields. One field not updated sometimes #6076

HarryC004 opened this issue May 21, 2024 · 0 comments

Comments

@HarryC004
Copy link

HarryC004 commented May 21, 2024

Environment

Knex version:2.4.2
Knex-postgis version: 0.14.3
Database + version: PostgreSQL 15.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-12), 64-bit
OS: Amazon RDS

Bug

  1. We have a single update query as following:
    await knex('table') .update({ deleted: true, deleted_by: deletedBy, deleted_at: new Date(), }) .where({ id: _id, deleted: false });
    all 3 columns, default are null;

However, I noticed in db, there are records that like following:
deleted: false,
deleted_by: xxxxx,
deleted_at: xxxxx

which means we updated deleted_by and deleted_at but didn't really update deleted in the above query.

So the question is:
Do anyone know why this is happening ? I don't necessary think its relate to knex but I am totally lost atm. Please help 🙏

Edit:
Few points that might help on analyse:

  • The table has no trigger at all
  • Only around 5% - 10% records are like this
  • There is no other places that update these columns
@HarryC004 HarryC004 closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant