Issue 119009 - Primary Index cannot be created
Summary: Primary Index cannot be created
Status: CONFIRMED
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: OOO330m20
Hardware: PC Windows Vista
: P3 Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-03 10:00 UTC by tommyads
Modified: 2013-01-29 21:47 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
sample database-table containing table without primary key (3.67 KB, application/vnd.sun.xml.base)
2012-03-03 10:00 UTC, tommyads
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description tommyads 2012-03-03 10:00:42 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!
Comment 1 r4zoli 2012-03-03 13:58:14 UTC
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