Hi,

WRT this bug entry http://code.google.com/p/ruby-sequel/issues/detail?id=317

I thought a primary key with multiple columns is more like an index
not a constraint.

When I add it to postgresql I get this....

                Table "public.fn_call"
    Column    |            Type             | Modifiers
--------------+-----------------------------+-----------
 user_id      | integer                     | not null
 store        | character varying(32)       | not null
 object       | character varying(32)       | not null
 fn           | character varying(64)       | not null
 args         | text                        |
 priority     | integer                     |
 date_updated | timestamp without time zone |
Indexes:
    "fn_call_pkey" PRIMARY KEY, btree (user_id, store, "object", fn)
Foreign-key constraints:
    "fn_call_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id)

and in mysql...

ysql> show index from fn_call;
+---------+------------+----------+--------------+-------------
+-----------+-------------+----------+--------+------+------------
+---------+
| Table   | Non_unique | Key_name | Seq_in_index | Column_name |
Collation | Cardinality | Sub_part | Packed | Null | Index_type |
Comment |
+---------+------------+----------+--------------+-------------
+-----------+-------------+----------+--------+------+------------
+---------+
| fn_call |          0 | PRIMARY  |            1 | user_id     |
A         |        NULL |     NULL | NULL   |      | BTREE
|         |
| fn_call |          0 | PRIMARY  |            2 | store       |
A         |        NULL |     NULL | NULL   |      | BTREE
|         |
| fn_call |          0 | PRIMARY  |            3 | object      |
A         |        NULL |     NULL | NULL   |      | BTREE
|         |
| fn_call |          0 | PRIMARY  |            4 | fn          |
A         |           0 |     NULL | NULL   |      | BTREE
|         |
+---------+------------+----------+--------------+-------------
+-----------+-------------+----------+--------+------+------------
+---------+
4 rows in set (0.00 sec)

Which seems to show it as an index not a constraint, so if we have a
drop_index wouldn't drop_primary_key make sense?

I moved the discussion here so someone can explain to me why a multi
primary key is a constraint and not an index, seems to me it is
identical to a unique index?

Once I understand I would be happy to submit a patch to add
drop_primary_key [:one, :two, :three] (I have submitted several of the
alter_table patches in the past, actually I think I added the
constraint migrations :)

However I think it would be dangerous to allow it to drop  a primary
key that was an autoindex column. I'd want it to just drop the index
not the column.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to