[Solved] Double <AutoField> with entry in table?

Discuss the database features
Post Reply
dreamquartz
Posts: 881
Joined: Mon May 30, 2011 4:02 am

[Solved] Double <AutoField> with entry in table?

Post by dreamquartz »

Hi All,

An other problem today, I did not come across before.
When trying to enter data in a table, "<AutoField>" immediately shows twice, leading to an error.
Removing auto increment on PK PersonID

Code: Select all

ALTER TABLE "tPerson"  ALTER COLUMN "PersonID" DROP GENERATED
, and using

Code: Select all

ALTER TABLE "tPerson" ALTER COLUMN "PersonID" SET GENERATED BY DEFAULT AS IDENTITY
, does not lead to solving it.

My understanding is that these 2 commands should solve this issue, but apparently not so.

Any suggestions?

Dream
Attachments
Capture-3-1.png
Last edited by dreamquartz on Thu Aug 03, 2017 3:34 am, edited 1 time in total.
LO 7.x, HSQLDB 2.7.x & Ubuntu 22.04 LTS.
dreamquartz
Posts: 881
Joined: Mon May 30, 2011 4:02 am

Re: Double <AutoField> with entry in table?

Post by dreamquartz »

dreamquartz wrote:Hi All,

An other problem today, I did not come across before.
When trying to enter data in a table, "<AutoField>" immediately shows twice, leading to an error.
Removing auto increment on PK PersonID

Code: Select all

ALTER TABLE "tPerson"  ALTER COLUMN "PersonID" DROP GENERATED
, and using

Code: Select all

ALTER TABLE "tPerson" ALTER COLUMN "PersonID" SET GENERATED BY DEFAULT AS IDENTITY
, does not lead to solving it.

My understanding is that these 2 commands should solve this issue, but apparently not so.

Any suggestions?

Dream
Answer to self:
This problem is caused by the database script file. In the file there was a line stating
“ALTER TABLE PUBLIC."tPerson" ALTER COLUMN "PersonID" RESTART WITH 1”
Looking at the table, the next record should be starting at 7358.
By changing the line in the script file from 1 to 7358, the database was back on track.

NOTE TO EVERYONE!!!!!!!!!!
MAKE A BACKUP FIRST, BEFORE MANIPULATING THE DATABASE SCRIPT FILE

Dream
LO 7.x, HSQLDB 2.7.x & Ubuntu 22.04 LTS.
Post Reply