How do I use a calc column as a Base Primary key

I am getting errors on trying to use a calc column as a base Primary Key. The errors are unique and data constraint errors.

The calc column is a varcahr as it has values as both alpha and numeric. I wish to use the column as a PK as I will relate it to columns in other tables. In calc I made sure there were no nulls and all values were unique. ANy help or suggestiosn are greatly appreciated.


I don’t see any problem creating a Base table with the information you have presented. As tested with LO

I do not agree with the use of this field as a primary key. In most cases the DB is going to assign, internally and out of view, a unique value when you use a varchar key.

As to why or what is causing your problem is not apparent. You have not presented what OS, LO version or database you are using (HSQL, Firebird, etc.). Steps taken in your process may also help. And definitely the exact error you are getting.

Ratslinger, thanks for the response.

I am running LO on a windows 7 SP 1, 64 bit box and I am using LibreOffice Base as the database.

i understand why some disagree with using a Varchar column as a PK yet as I mentioned I want to relate the column to another table where it will there be a FK . And to make that relation to a FK it seems that LO Base about insists the column in the first table to be a FK to properly relate. And the reason I have it as a varchar is because the column has both alpha and numeric values.

I did find the problem. In Calc, before cutting and pasting I had performed a duplicate check function and had no duplicates with that function. I found a different function to check for duplicates and this new function did find one duplicate so that was my problem.

So my problem was not the inport into Base it was a faulty duplicate check in Calc.