Apache OpenOffice (AOO) Bugzilla – Issue 119009
Primary Index cannot be created
Last modified: 2013-01-29 21:47:32 UTC
Created attachment 77271 [details] sample database-table containing table without primary key Create a new empty database. In calc, select some cells, with header-line on top, copy the cells. Paste the cells as a new table in the database, in the wizard don't create a primary key. Then edit the table-definition and set a primary key, then save. But the index is not created or saved, and therefore editing the table is not possible. See attached an example: you cannot define a primary key for this table!
All tables needs primary key in Base to add data. The copy table wizard contains option in first window when you can select it and it add PK with new ID column. If you miss that step, the copy wizard warns you to add PK to your table. If you ignore that warning, the wizard create table without PK. This is a known bug, I needs to find that, and mark this as duplicate of that bug. But you can use with menu Tools>SQL... SQL command window, and execute this commmand: ALTER TABLE "Tabelle1" ADD "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY BEFORE "a". If it is run successfully, add new "ID" field with autoincrement values. After that refresh table, View>Refresh Table... then you can add more data to your table