Bug 277435 - Add support for creating multi-column primary key
Summary: Add support for creating multi-column primary key
Status: CONFIRMED
Alias: None
Product: KEXI
Classification: Applications
Component: Tables (show other bugs)
Version: 3.0.x
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Kexi Bugs
URL:
Keywords:
: 144841 (view as bug list)
Depends on:
Blocks: 264392
  Show dependency treegraph
 
Reported: 2011-07-09 21:07 UTC by Jaime Torres
Modified: 2014-12-03 01:49 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaime Torres 2011-07-09 21:07:59 UTC
Version:           2.4 rc1 (Calligra 2.4 rc1) (using Devel) 
OS:                Linux

I'm unable to create a primary key of more than one column.
When One column has the primary key, if I try to set another column also primary key, the first one is not primary key.
I've tried also selecting multiple columns, not possible.


Reproducible: Always

Steps to Reproduce:
I connect to an empty mysql database.
Create a new table from kexi.
Create 3 integer columns.
Make the first column primary key.
Try to make another column primary key.


Expected Results:  
Be able to create tables with more than one column as primary key.
Comment 1 Marko Knöbl 2012-02-23 22:42:09 UTC
I think this behaviour is intentional and should not be changed. It corresponds to the common definition of a primary key. According to Wikipedia, "A table can have at most one primary key, but more than one unique key."

If you have a special usecase where you would want to use more than one primary key I suggest you ask in the forums how to do that in Kexi - I think there will be a way to do it which does not involve multiple primary keys.
Comment 2 Jarosław Staniek 2012-02-23 23:06:34 UTC
The current behaviour is intentional. 

That said, compound keys [1] will eventually come to Kexi in a form of dedicated option, so this report has been set as a Wishlist and marked as NEW. Good thing is that SQLite somewhat supports them (but I not tested this feature heavily):

"Optionally, a PRIMARY KEY for the table. Both single column and composite (multiple column) primary keys are supported." [2]

Also, relates to Bug #249966 - "Add composite primary keys support for many-to-many relationships"

[1] http://en.wikipedia.org/wiki/Compound_key
[2] http://www.sqlite.org/lang_createtable.html
Comment 3 Jaime Torres 2012-02-24 08:41:01 UTC
Sorry for my poor English. I did not know how to say "composite primary keys".

Until I'm able to create one-to-many or many-to-many relationships with Kexi, I can not replace Acc... with Kexi.
Comment 4 Jarosław Staniek 2012-02-24 09:59:22 UTC
Jaime, I see and understand your need, we're both users too. Please don't be afraid of sharing more needs as wishlists using this web site :)
Comment 5 Jarosław Staniek 2012-08-11 12:19:28 UTC
*** Bug 144841 has been marked as a duplicate of this bug. ***