Menu

#4619 (ok 4.3.1) SELECT LENGTH(`field`) FROM `table` does not sort

4.3.0
fixed
None
1
2014-12-08
2014-12-04
No

This is related to [#4030].

"SELECT LENGTH(field) FROM table" properly shows the list. But I am not able to sort the list. Clicking on the column "LENGTH(field)" shows the "Loading..." message and after a few seconds … nothing changed.

I am not able to sort by that column.

Related

Bugs: #4030

Discussion

  • Marc Delisle

    Marc Delisle - 2014-12-04

    I cannot reproduce this problem with version 4.2.13. Please attach a small export of your table.

     
  • Alexander Schuch

    -- phpMyAdmin SQL Dump
    -- version 4.2.13
    -- http://www.phpmyadmin.net
    --
    -- Generation Time: Dec 05, 2014 at 04:18 PM
    -- Server version: 5.5.40-36.1-log
    -- PHP Version: 5.3.10-1ubuntu3.15

    SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
    SET time_zone = "+00:00";

    --
    -- Database: test
    --


    --
    -- Table structure for table test
    --

    CREATE TABLE IF NOT EXISTS test (
    i int(11) NOT NULL,
    t mediumtext COLLATE utf8_unicode_ci NOT NULL
    ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

    --
    -- Dumping data for table test
    --

    INSERT INTO test (i, t) VALUES
    (1, 'abc'),
    (2, 'bcd'),
    (3, 'cdef');

    --
    -- Indexes for dumped tables
    --

    --
    -- Indexes for table test
    --
    ALTER TABLE test
    ADD PRIMARY KEY (i);

    --
    -- AUTO_INCREMENT for dumped tables
    --

    --
    -- AUTO_INCREMENT for table test
    --
    ALTER TABLE test
    MODIFY i int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;

    The editor here seems to destroy backticks.

    "SELECT LENGTH(t) FROM [bt]test[/bt]" works, "SELECT LENGTH([bt]t[/bt]) FROM [bt]test[/bt]" doesn't.

     
  • Marc Delisle

    Marc Delisle - 2014-12-05
    • status: pending --> open
     
  • Marc Delisle

    Marc Delisle - 2014-12-05

    Thanks. With backticks around the column name, I can reproduce the problem in 4.2.13 and 4.3.0.

     
  • Hugues Peccatte

    Hugues Peccatte - 2014-12-06

    More details, if needed:
    SELECT LENGTH(field), LENGTH([bt]field[/bt]) FROM table
    will throw an error even if you try to sort on the length without backticks. So it's not specific to the sorted column, but to the fact that you try to sort a result of a query with a function call on a field with backticks.

     

    Last edit: Hugues Peccatte 2014-12-06
  • Marc Delisle

    Marc Delisle - 2014-12-06
    • assigned_to: Hugues Peccatte
     
  • Marc Delisle

    Marc Delisle - 2014-12-08
    • summary: SELECT LENGTH(field) FROM table does not sort --> (ok 4.3.1) SELECT LENGTH(field) FROM table does not sort
    • status: open --> resolved
    • Group: 4.2.13 --> 4.3.0
    • Priority: 5 --> 1
     
  • Marc Delisle

    Marc Delisle - 2014-12-08
    • Status: resolved --> fixed