~ubuntu-branches/ubuntu/natty/mysql-5.1/natty-proposed

« back to all changes in this revision

Viewing changes to mysql-test/r/group_by.result

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 08:30:45 UTC
  • mfrom: (1.4.1)
  • Revision ID: package-import@ubuntu.com-20120222083045-2rd53r4bnyx7qus4
Tags: 5.1.61-0ubuntu0.11.04.1
* SECURITY UPDATE: Update to 5.1.61 to fix multiple security issues
  (LP: #937869)
  - http://www.oracle.com/technetwork/topics/security/cpujan2012-366304.html
  - CVE-2011-2262
  - CVE-2012-0075
  - CVE-2012-0112
  - CVE-2012-0113
  - CVE-2012-0114
  - CVE-2012-0115
  - CVE-2012-0116
  - CVE-2012-0117
  - CVE-2012-0118
  - CVE-2012-0119
  - CVE-2012-0120
  - CVE-2012-0484
  - CVE-2012-0485
  - CVE-2012-0486
  - CVE-2012-0487
  - CVE-2012-0488
  - CVE-2012-0489
  - CVE-2012-0490
  - CVE-2012-0491
  - CVE-2012-0492
  - CVE-2012-0493
  - CVE-2012-0494
  - CVE-2012-0495
  - CVE-2012-0496

Show diffs side-by-side

added added

removed removed

Lines of Context:
1855
1855
COUNT(*)
1856
1856
2
1857
1857
DROP TABLE t1;
 
1858
#
 
1859
# Bug#59839: Aggregation followed by subquery yields wrong result
 
1860
#
 
1861
CREATE TABLE t1 (
 
1862
a INT,
 
1863
b INT,
 
1864
c INT,
 
1865
KEY (a, b)
 
1866
);
 
1867
INSERT INTO t1 VALUES
 
1868
( 1, 1,  1 ),
 
1869
( 1, 2,  2 ),
 
1870
( 1, 3,  3 ),
 
1871
( 1, 4,  6 ),
 
1872
( 1, 5,  5 ),
 
1873
( 1, 9, 13 ),
 
1874
( 2, 1,  6 ),
 
1875
( 2, 2,  7 ),
 
1876
( 2, 3,  8 );
 
1877
EXPLAIN
 
1878
SELECT a, AVG(t1.b),
 
1879
(SELECT t11.c FROM t1 t11 WHERE t11.a = t1.a AND t11.b = AVG(t1.b)) AS t11c,
 
1880
(SELECT t12.c FROM t1 t12 WHERE t12.a = t1.a AND t12.b = AVG(t1.b)) AS t12c
 
1881
FROM t1 GROUP BY a;
 
1882
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
1883
1       PRIMARY t1      index   NULL    a       10      NULL    9       Using index
 
1884
3       DEPENDENT SUBQUERY      t12     ref     a       a       10      func,func       2       Using where
 
1885
2       DEPENDENT SUBQUERY      t11     ref     a       a       10      func,func       2       Using where
 
1886
SELECT a, AVG(t1.b),
 
1887
(SELECT t11.c FROM t1 t11 WHERE t11.a = t1.a AND t11.b = AVG(t1.b)) AS t11c,
 
1888
(SELECT t12.c FROM t1 t12 WHERE t12.a = t1.a AND t12.b = AVG(t1.b)) AS t12c
 
1889
FROM t1 GROUP BY a;
 
1890
a       AVG(t1.b)       t11c    t12c
 
1891
1       4.0000  6       6
 
1892
2       2.0000  7       7
 
1893
DROP TABLE t1;
 
1894
#
 
1895
# Bug#11765254 (58200): Assertion failed: param.sort_length when grouping
 
1896
# by functions
 
1897
#
 
1898
SET SQL_BIG_TABLES=1;
 
1899
CREATE TABLE t1(a INT);
 
1900
INSERT INTO t1 VALUES (0),(0);
 
1901
SELECT 1 FROM t1 GROUP BY IF(`a`,'','');
 
1902
1
 
1903
1
 
1904
SELECT 1 FROM t1 GROUP BY TRIM(LEADING RAND() FROM '');
 
1905
1
 
1906
1
 
1907
SELECT 1 FROM t1 GROUP BY SUBSTRING('',SLEEP(0),'');
 
1908
1
 
1909
1
 
1910
Warnings:
 
1911
Warning 1292    Truncated incorrect INTEGER value: ''
 
1912
Warning 1292    Truncated incorrect INTEGER value: ''
 
1913
Warning 1292    Truncated incorrect INTEGER value: ''
 
1914
SELECT 1 FROM t1 GROUP BY SUBSTRING(SYSDATE() FROM 'K' FOR 'jxW<');
 
1915
1
 
1916
1
 
1917
Warnings:
 
1918
Warning 1292    Truncated incorrect INTEGER value: 'K'
 
1919
Warning 1292    Truncated incorrect INTEGER value: 'jxW<'
 
1920
Warning 1292    Truncated incorrect INTEGER value: 'K'
 
1921
Warning 1292    Truncated incorrect INTEGER value: 'jxW<'
 
1922
Warning 1292    Truncated incorrect INTEGER value: 'K'
 
1923
Warning 1292    Truncated incorrect INTEGER value: 'jxW<'
 
1924
DROP TABLE t1;
 
1925
SET SQL_BIG_TABLES=0;
1858
1926
# End of 5.1 tests