Bug: Sql import indexes are not parsed properly #275
Replies: 13 comments
-
Additional info on KEY index: see. |
Beta Was this translation helpful? Give feedback.
-
vcode extension v0.9.7 has been reflected. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
Automatically generated indexes are not explicitly managed as index data. |
Beta Was this translation helpful? Give feedback.
-
Okay but an UNIQUE index isn't automatically generated or rather the user still needs to add it. |
Beta Was this translation helpful? Give feedback.
-
Nono that's not what i mean. |
Beta Was this translation helpful? Give feedback.
-
Yeah, if i add the view change i can see it aswell. But it is still not present in the table properties tab. |
Beta Was this translation helpful? Give feedback.
-
Doesn't UNIQUE KEY generate indexes automatically? |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
I checked that it was missing from the simple table SQL DDL. PRIMARY KEY, UNIQUE KEY can't be edited. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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); |
Beta Was this translation helpful? Give feedback.
-
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.
Beta Was this translation helpful? Give feedback.
All reactions