You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Primary key rename leads to unwanted schema change #4163
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) )
Version 3.12.2 is rather old. Have you tried the latest release? While I see the schema change, I cannot see an issue with the auto-increment behavior afterwards.
Would like to but cannot test latest release due to policy from my employer.
Do you mean you tried in QGis ? Should I provide screenshots from that software to show the difference ?
The create statement can be written in various ways.. The way db4s does it is not 'wrong' or incorrect.
Have you tried adding a record in db4s to confirm the record increments correctly?
Do you mean you tried in QGis ? Should I provide screenshots from that software to show the difference ?
I have not tested with QGis, but with DB4S, as this is the issue tracker for DB4S and I do not think that installing arbitrary software for this helps with this issue. The auto-increments work correctly with the changed schema in DB4S in the latest version and - as Chris mentioned - there are multiple ways to express CREATE statements. If you have to modify your third-party databases with DB4S and this leads to the database not being handled correctly externally while still using valid syntax, I would argue that the external application should fix it and not DB4S. For this reason, I am tempted to close this issue as invalid.
I still believe DB4S shouldn't change initial provided schema
With renaming columns, you are changing the schema, and in these cases I do not see an issue with using an equivalent "normalized" schema definition. While we could consider it an enhancement/feature request, given the current status about active maintenance this is unlikely of getting changed in the near future unless you are providing a straightforward patch yourself.
Activity
FriedrichFroebel commentedon Jul 23, 2026
Version 3.12.2 is rather old. Have you tried the latest release? While I see the schema change, I cannot see an issue with the auto-increment behavior afterwards.
VxTedxV commentedon Jul 24, 2026
Would like to but cannot test latest release due to policy from my employer.
Do you mean you tried in QGis ? Should I provide screenshots from that software to show the difference ?
chrisjlocke commentedon Jul 24, 2026
The create statement can be written in various ways.. The way db4s does it is not 'wrong' or incorrect.
Have you tried adding a record in db4s to confirm the record increments correctly?
FriedrichFroebel commentedon Jul 24, 2026
I have not tested with QGis, but with DB4S, as this is the issue tracker for DB4S and I do not think that installing arbitrary software for this helps with this issue. The auto-increments work correctly with the changed schema in DB4S in the latest version and - as Chris mentioned - there are multiple ways to express CREATE statements. If you have to modify your third-party databases with DB4S and this leads to the database not being handled correctly externally while still using valid syntax, I would argue that the external application should fix it and not DB4S. For this reason, I am tempted to close this issue as invalid.
VxTedxV commentedon Jul 24, 2026
I understand. I still believe DB4S shouldn't change initial provided schema -> enhancement ?
BTW, thanks for your answers !
FriedrichFroebel commentedon Jul 24, 2026
With renaming columns, you are changing the schema, and in these cases I do not see an issue with using an equivalent "normalized" schema definition. While we could consider it an enhancement/feature request, given the current status about active maintenance this is unlikely of getting changed in the near future unless you are providing a straightforward patch yourself.