Repository navigation
Conversation
SELECT * does not return invisible columns, so the result metadata of the following columns was read at the wrong position. Leave invisible columns out of the columns used for the form. Signed-off-by: Магда М.Г. <mail@mgmagda.ru>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## QA_5_2 #20565 +/- ##
============================================
+ Coverage 50.42% 50.44% +0.02%
- Complexity 17261 17264 +3
============================================
Files 607 607
Lines 68333 68340 +7
============================================
+ Hits 34455 34476 +21
+ Misses 33878 33864 -14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
williamdes
left a comment
There was a problem hiding this comment.
Look okay for me, I will leave the review to @kamil-tekiela
|
If all you want to do is skip this column look at the line 2516. Filtering like this in |
|
Skipping at line 2516 alone is not enough: Two ways that I see:
Which one would you prefer? |
|
What do you mean is not enough? I don't understand your reply. |
|
Sorry, I'll be more concrete. Take the table from #19539: CREATE TABLE `user` (
`my_row_id` bigint unsigned NOT NULL AUTO_INCREMENT INVISIBLE,
`id` char(36) NOT NULL,
`created_at` timestamp NOT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`my_row_id`)
);
$column['len'] = $this->dbi->getFieldsMeta($currentResult)[$columnNumber]->length;For So skipping is fine for the invisible column itself, but the metadata lookup at that line also needs the position of the column in the result, not in the table. Shall I do it that way (skip at 2516 and pass the result position for the metadata), or do you have something else in mind? |
| // Invisible columns are not returned by SELECT *, so they cannot be shown in the form | ||
| // without shifting the result metadata of the following columns. | ||
| return array_values(array_filter( | ||
| $this->dbi->getColumns($db, $table, true), | ||
| static function (array $column): bool { | ||
| return ! isset($column['Extra']) || ! is_string($column['Extra']) | ||
| || stripos($column['Extra'], 'INVISIBLE') === false; | ||
| } | ||
| )); |
There was a problem hiding this comment.
| // Invisible columns are not returned by SELECT *, so they cannot be shown in the form | |
| // without shifting the result metadata of the following columns. | |
| return array_values(array_filter( | |
| $this->dbi->getColumns($db, $table, true), | |
| static function (array $column): bool { | |
| return ! isset($column['Extra']) || ! is_string($column['Extra']) | |
| || stripos($column['Extra'], 'INVISIBLE') === false; | |
| } | |
| )); | |
| return array_values(array_filter( | |
| $this->dbi->getColumns($db, $table, true), | |
| static function (array $column): bool { | |
| return ! isset($column['Extra']) || ! is_string($column['Extra']) | |
| || ! str_contains($column['Extra'], 'INVISIBLE'); | |
| } | |
| )); |
|
Ok, I understand now. So the only two options are:
In that case, filtering them out in |
Signed-off-by: Магда М.Г. <mail@mgmagda.ru>
|
Applied the suggestion (str_contains). Thanks for looking into it. |
Fixes #19539
Same fix as #20560, for
QA_5_2as suggested there.SELECT *does not return invisible columns (MySQLINVISIBLE, including the generated invisible primary keymy_row_id, and MariaDBINVISIBLE), but the insert/edit form iterates over all table columns and reads the result metadata by position. With an invisible column in the table, the metadata of the following columns is shifted and the form showsUndefined array keywarnings.This leaves invisible columns out in
InsertEdit::getTableColumns(), so the form columns and the result metadata line up again. Invisible columns are not shown in the form, the same as inSELECT *.Test:
testGetTableColumnsSkipsInvisibleColumns.