upper / db

Data Access Layer (DAL) for PostgreSQL, CockroachDB, MySQL, SQLite and MongoDB with ORM-like features.
https://upper.io/
MIT License
3.53k stars 234 forks source link

Feature request: New tag to ignore identity columns on update #679

Open lampi87 opened 1 year ago

lampi87 commented 1 year ago

At the moment identity columns are not ignored on using updater for mssql connection like

q = sess.SQL().
  Update("user").
  Set(user).Where("id = ?", 5)
res, err = q.Exec()

This will lead to an error mssql: Cannot update identity column 'id'. because column "id" is included into update SQL query

UPDATE [user] SET ..., [id] = ?, ... WHERE (id = ?)

Is it possible to add an additional tag like omitupdate or something else to mark "id" column to be ignored?