Skip to content

[Bug]: Primary key rename leads to unwanted schema change #4163

Description

@VxTedxV

What did you do?

When renaming a non-editable default "pkuid" primary key name from a table generated from QGis with this kind of table schema :
CREATE TABLE "table_name" (pkuid integer primary key autoincrement, ....)
DB Browser for SQLite alters it to
CREATE TABLE "table_name" ("new_key_name" integer, .... , PRIMARY KEY ("new_key_name" AUTOINCREMENT) )
All seems to work until creating entities in QGis when primary key autoincrementing doesn't work anymore.
See qgis/QGIS#22330

What did you expect to see?

I expect that DB Browser for SQLite respects initial schema :
CREATE TABLE "table_name" ("new_key_name" integer primary key autoincrement, ....)

What did you see instead?

Instead it recreates the table like this :
CREATE TABLE "table_name" ("new_key_name" integer, .... , PRIMARY KEY ("new_key_name" AUTOINCREMENT) )

DB4S Version

3.12.2

What OS are you seeing the problem on?

Windows

OS version

Windows 11

Relevant log output

Prevention against duplicate issues

  • I have searched for similar issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions