Repository navigation
Bug: Sql import indexes are not parsed properly #275
Replies: 14 comments
|
vcode extension v0.9.7 has been reflected. |
|
Seems to be partially fixed both indexes are not present as keys in the table, but only the "KEY" index is added to the indexes of the table. The unique index is missing. Try to run my example SQL. |
|
Automatically generated indexes are not explicitly managed as index data. |
|
Okay but an UNIQUE index isn't automatically generated or rather the user still needs to add it. |
|
Yeah, if i add the view change i can see it aswell. But it is still not present in the table properties tab. |
|
Doesn't UNIQUE KEY generate indexes automatically? |
|
It does, but i think it makes sense for it to be in the list of indexes. I personally think all indexes should be listed in the table properties indexes section of the app, it can be confusing to the user to see some indexes only when you change the app view. Honestly i doesn't really matter where you define the indexes: wether it be immediately in the CREATE TABLE statement or in a following CREATE INDEX statement. |
|
Okay no, I wasn't talking about the Primary key. That's fine the way it is. I'm talking about the custom UNIQUE index i'm creating on email. According to this I think i understand what you where saying earlier. Now how you actually generate the table could change based on how every index is defined:
Again i don't think it matters that much as all of the SQL it is generating is going to be used to create a DATABASE from scratch. |
|
For example the SQL query i was tesing with can be rapresented as: CREATE TABLE 'users' (
'id' bigint unsigned NOT NULL AUTO_INCREMENT,
'name' varchar(30) NOT NULL,
'email' varchar(30) NOT NULL UNIQUE,
PRIMARY KEY ('id'),
KEY 'user_name_index' ('name')
);Of course with multi key indexes you need to use the KEY statement. Or as: CREATE TABLE 'users' (
'id' bigint unsigned NOT NULL AUTO_INCREMENT,
'name' varchar(30) NOT NULL,
'email' varchar(30) NOT NULL,
PRIMARY KEY ('id'),
);
CREATE UNIQUE INDEX users_email_index
ON users(email ASC);
CREATE INDEX users_name_index
ON users(name ASC); |
|
Fixed in #460: the SQL above now imports with PRIMARY KEY on id, UNIQUE KEY users_email_unique as email's UQ flag (listed in the Indexes tab as a read-only key row) and KEY user_name_index as an index, and a composite UNIQUE imports as one unique index. |




Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
When importing an SQL table containing indexes those are not parsed properly into index properties but are instead left as keys in the table.
To reproduce:
SQL Code:
Result:
Additionally the index section of the table properties is not populated.
All reactions