-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySQL columnInfo(): Duplicated rows when more than 1 index exists for a field #63
Comments
We still need to pull the values for |
Same here. When will it be fixed ? Tks |
@carolin-skiply Feel free to open a PR to fix it, that's the quickest way to have it fixed 😉 |
Just coming by and having a look; is there anyone working on a PR? |
@Beiri22 Not to my knowledge. Wanna pick it up? |
Hi,
I'm using MySQL 5.7, and it looks like a column with multiple indexes is displayed multiple times when using
columnInfo('table_name')
.I've seen this caused problems in directus/directus#6204.
I've been looking at the source code of
columnInfo()
and tested it on a MySQL instance, and found that the issue comes from the tableINFORMATION_SCHEMA.KEY_COLUMN_USAGE
and theLEFT JOIN
done on it, duplicating the rows fromINFORMATION_SCHEMA.COLUMNS
(for MySQL).Only the
columnInfo('table_name', 'column_name')
function seems to work properly (not showing any duplicate entries), since it only returns the first column found.Using a
GROUP BY c.TABLE_NAME, c.COLUMN_NAME
on the query looks like it prevents the duplicate indexes to show up, but there might be loss of information in that case?The text was updated successfully, but these errors were encountered: