create copy of table

BubikolRamios's profile image BubikolRamios posted 12 years ago in General Permalink
1.right click on table: create copy --> cant get that anymore, I dont remember in which situation that was available - 30 seconds ago (-: , how to do that again ?
BubikolRamios's profile image BubikolRamios posted 12 years ago Permalink
Ok, forget upper, problem:

Want to copy auto inc column into new table. --> must be defined as a key error , not sure in which index it is, and a window that I'm looking at is modal.

Ok, if I look back to indexes, it is part of primary key, and the other fields in PK are not to be copyed to new table, so this is no go.

Mybe, if field is autoinc in source table, it should be , copying to new table be automaticaly converted to type of int ?

Otherwise even if all compatible I'm not suure what will happen.

if in source table auto inc are 6,8,10, will in new table be that or 1,2,3.
BubikolRamios's profile image BubikolRamios posted 12 years ago Permalink
To simplify - want to copy only structure,not all columns. No data. No indexes.

Can not do coz of auto inc beeing requested to be a key.

Same as above, mybe it shold be automatialy converteed from autoinc to int.
ansgar's profile image ansgar posted 12 years ago Permalink

Can not do coz of auto inc beeing requested to be a key



Does that mean you get an error message or what? If yes which one is it?

mybe it shold be automatialy converteed from autoinc to int.



auto_increment is an attribute, not a data type, at least in MySQL. An auto_increment flagged column is always of type TINYINT/SMALLINT/INT/MEDIUMINT/BIGINT. So my guess is you want to remove the auto_increment attribute when copying? Or do you want to leave out the values for that column? In that case you can just uncheck the column in the "Copy table" dialog, and add a new id column afterwards.
BubikolRamios's profile image BubikolRamios posted 12 years ago Permalink
must be defined as a key error


yes error: 1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key

hence yes: I want to remove the auto_increment attribute (at new table ofcourse) when copying, othervise I can't copy table via HSQL create copy.

I mean, if I remove index from (include from souce table) autoinc field, HSQL should then automaticaly remove autoinc attribute from autoinc field that goes to target table.


No I don't want to leave out values for that column, nor column itself.
BubikolRamios's profile image BubikolRamios posted 12 years ago Permalink
I mean, if I remove index from (include from souce table) autoinc field, HSQL should then automaticaly remove autoinc attribute from autoinc field that goes to target table.

I hope that makes sence.
ansgar's profile image ansgar posted 12 years ago Permalink
I'm confused.

No I don't want to leave out values for that column, nor column itself.


if in source table auto inc are 6,8,10, will in new table be that or 1,2,3.



As said. You can uncheck that autoinc column and add a new one after the table is copied. What's wrong with that approach?
BubikolRamios's profile image BubikolRamios posted 12 years ago Permalink
BTW - it would be nice if complete error message popping up from HSQL could be copyed from message box. Can't be done now, you can only click OK.
ansgar's profile image ansgar posted 12 years ago Permalink
Hm, I think I got it now. I'm trying to say in my own words: If you uncheck a primary key in the "Copy table" dialog, HeidiSQL does not yet remove an auto_increment attribute from the relevant column.
Right?
ansgar's profile image ansgar posted 12 years ago Permalink
You can always press Ctrl+C in a message box - that's a Windows feature.
BubikolRamios's profile image BubikolRamios posted 12 years ago Permalink
Right.

Damn I did not know about that copy stuff (-:. Thanks.
ansgar's profile image ansgar posted 12 years ago Permalink
Hehe, me too, a colleague told me not long ago about Ctrl+C in a message dialog. Well, having 20 years of computer experience does not say one knows each and every feature...
Code modification/commit from ansgar.becker, 12 years ago, revision 7.0.0.4204
AUTO_INCREMENT attribute requires a primary key on the same column. So, in the copy table dialog, if the user unchecks the primary key, we need to auto-remove the AUTO_INCREMENT attribute as well. Otherwise the dialog runs into an error "there can be only one auto column and it must be defined as a key". See http://www.heidisql.com/forum.php?t=11238
ansgar's profile image ansgar posted 12 years ago Permalink
r4204 now auto-removes the AUTO_INCREMENT attribute if you uncheck a primary key in the "copy table" dialog. Also, the table attribute "AUTO_INCREMENT=6" or whatever is auto-removed by Heidi then. Otherwise, if you add a primary key later, you would start at id "6" again (as an example).

BubikolRamios, I get the impression you are the top-bug/feature-requester here, and I responded to 80% of these with some code change, followed by a "Fixed in rXYZ". I'm curious: Do you use HeidiSQL the whole day for anything, or how is your job? Is your motivation for requesting features driven by "look at the great other client XYZ, should be in HeidiSQL too"? For the latter one - I don't have the impression that this is your motiviation, I only want to be sure here.
BubikolRamios's profile image BubikolRamios posted 12 years ago Permalink
"look at the great other client XYZ"


Yeah, I had two that type of request only.

First was something from TOAD as HSQL lets you think you imported all rows from csv, saying nothing and I used TOAD for a while for that.

Second I was playing with TOAD a while and it lets you edit data that are result of joined query. Sometimes that would come handy, doh not often. But I bet if that would be in HSQL people would get used to use that all the time.

All, the rest is pure HSQL usage all the time on developing my site agrozoo.net

Doh I doubt I'm the top requester (-:



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