Skip to content
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

Distinct URLs are broken on nullable text fields #16896

Closed
williamdes opened this issue May 11, 2021 · 2 comments
Closed

Distinct URLs are broken on nullable text fields #16896

williamdes opened this issue May 11, 2021 · 2 comments
Assignees
Labels
Bug A problem or regression with an existing feature patch
Projects
Milestone

Comments

@williamdes
Copy link
Member

Describe the bug

Distinct URLs are broken on text fields because they are detected as numeric

To Reproduce

CREATE TABLE `t1` (
  `id` int(11) NOT NULL,
  `text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
  `text2` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

INSERT INTO `t1` (`id`, `text`, `text2`) VALUES
(1, 'zz', 'd'),
(2, 'bb', 'f');

Steps to reproduce the behavior:

  1. Go to table structure
  2. Click on distinct values for nullable column
  3. The link is broken

Expected behavior

Working links

Server configuration

  • phpMyAdmin version: 5.1
@williamdes williamdes added the Bug A problem or regression with an existing feature label May 11, 2021
@williamdes williamdes added this to Needs triage in issues via automation May 11, 2021
@williamdes williamdes moved this from Needs triage to Reproduced in issues May 11, 2021
@williamdes
Copy link
Member Author

For information: the code calls getDataCellForNumericColumns for this column

@williamdes
Copy link
Member Author

williamdes commented May 14, 2021

diff --git a/libraries/classes/Display/Results.php b/libraries/classes/Display/Results.php
index 6ff0992919..fcfee0d0d5 100644
--- a/libraries/classes/Display/Results.php
+++ b/libraries/classes/Display/Results.php
@@ -2950,7 +2950,9 @@ class Results
             // even for a string type
             // for decimal numeric is returning 1
             // have to improve logic
-            if (($meta->numeric == 1 && $meta->type !== 'string') || $meta->type === 'real') {
+            // Nullable text fields and text fields have the blob flag
+            $isNumericAndNotBlob = $meta->numeric == 1 && $meta->blob == 0;
+            if (($isNumericAndNotBlob && $meta->type !== 'string') || $meta->type === 'real') {
                 // n u m e r i c
 
                 $display_params['data'][$row_no][$i]

here is the patch, to be tested
real blob fields do not work for distinct values

@williamdes williamdes added this to the 5.1.2 milestone Jun 11, 2021
williamdes added a commit that referenced this issue Jun 21, 2021
Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit that referenced this issue Jun 23, 2021
Signed-off-by: William Desportes <williamdes@wdes.fr>
issues automation moved this from Reproduced to Closed Jun 23, 2021
@williamdes williamdes self-assigned this Jun 23, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature patch
Projects
issues
  
Closed
Development

No branches or pull requests

1 participant