Skip to content

[Bug]: [Postgres/sequelize] Error on updating a record when using identity "id" #1783

Open

Description

@Paroca72

Contact Details

No response

What happened?

When try to update a record from the adminjs admin panel I got this error
"SequelizeDatabaseError: column "id" can only be updated to DEFAULT"

This happen with all the table than has an "id" column as identity:
Image

It seems adminjs create a wrong update sql
SQL:

UPDATE "company_offers" 
SET "id"=$1,"updated_date"=$2,"updated_by"=$3,"created_date"=$4,"created_by"=$5 
WHERE "id" = $6"

Params:
[ 2, "2025-01-21 14:03:13.107 +07:00", 16, "2024-07-09 09:06:11.537 +07:00", 2, 2,]

As you can see the update include the "id" column even if the value is not changed.
Furthermore as you can see as follow the "id" column is declared as auto-increment and should not be included inside the update code.

id: {
    field: "id",
    type: DataTypes.BIGINT,
    autoIncrement: true,
    // autoIncrementIdentity: true, ALSO NOT WORK
    primaryKey: true,
},

Thanks for your help

Bug prevalence

Always

AdminJS dependencies version

Adminjs 7.8.15
@adminjs/sequelize ^4.1.1
@adminjs/express ^6.1.1

What browsers do you see the problem on?

No response

Relevant log output

"SequelizeDatabaseError: column "id" can only be updated to DEFAULT"

Relevant code that's giving you issues

Activity

  1. added
    bug
    on Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions