Duplicate row with primary key

[expired user #3398]'s profile image [expired user #3398] posted 8 years ago in Feature discussion Permalink

I'm using HeidiSQL often in a MySQL table with a primary key which is spanned over 3 columns.

When I duplicate one row, the primary key columns are not duplicated to the new editable row. I can imagine why, but in my case I often have to change one digit in only one column. Actually I have to fill the three columns manually because I cant leave the row to copy the values from the origin row. As a workaround I export the row(s) as SQL and make my change in the SQL editor before executing.

For this case it would be nice, to get a preference-checkbox (or something else -> a new [full]duplicate command; shortcut;...) which enables to duplicate the (primary/unique) keys as well. Theoretically it should possible because the row will be saved only if I leave the row (and changed the value of course).

I would be glad if this request will implemented :-)

(I moved from SQLyog months ago, there I had that feature but I'm using HeidiSQL now because of many other features)

[expired user #3398]'s profile image [expired user #3398] posted 8 years ago Permalink

Addendum: An auto-increment value with "key" attribute (non primary) will be duplicated, but there I have to enter manually "0" to make it auto increment again.

ansgar's profile image ansgar posted 8 years ago Permalink

Originally, HeidiSQL overtook all values, also from primary key columns. In issue #1608 one user complained about that, and so I changed that.

I guess I can introduce a new menu item for some Duplicate row including PK values action.

[expired user #3398]'s profile image [expired user #3398] posted 8 years ago Permalink

Originally, HeidiSQL overtook all values, also from primary key columns. In issue #1608 one user complained about that, and so I changed that.

I guess I can introduce a new menu item for some Duplicate row including PK values action.

In case of an auto increment (also without primary attribute) I'd agree to #1608. they should not be duplicated. (But also not if they're only "key" and not "primary", see my addendum in post #2)

So my wish would be: "Full duplicate" would duplicate all columns (incl. primary) but not auto increment values (equal if they "key" or "primary")

I see, many user have many different requirements... ;)

Please login to leave a reply, or register at first.