From 475eac91ce320321a499e546f5c9e308c680a5e2 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 17 Jul 2007 14:43:56 -0400 Subject: [PATCH 01/49] Bug #29784 YaSSL assertion failure when reading 8k key. Fixed the yassl base64 decoding to correctly allocate a maximum decoded buffer size. mysql-test/std_data/server8k-cert.pem: BitKeeper file /Users/dkatz/50/mysql-test/std_data/server8k-cert.pem mysql-test/std_data/server8k-key.pem: BitKeeper file /Users/dkatz/50/mysql-test/std_data/server8k-key.pem extra/yassl/taocrypt/src/coding.cpp: Fixed buffer allocation to compute the proper maximum decoded size: (EncodedLength * 3/4) + 3 mysql-test/r/ssl_8k_key.result: New BitKeeper file ``mysql-test/r/ssl_8k_key.result'' Test connection to server using large SSL key. mysql-test/t/ssl_8k_key.test: New BitKeeper file ``mysql-test/t/ssl_8k_key.test'' Test connection to server using large SSL key. --- extra/yassl/taocrypt/src/coding.cpp | 2 +- mysql-test/r/ssl_8k_key.result | 2 + mysql-test/std_data/server8k-cert.pem | 51 ++++++++++++++ mysql-test/std_data/server8k-key.pem | 99 +++++++++++++++++++++++++++ mysql-test/t/ssl_8k_key.test | 6 ++ 5 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 mysql-test/r/ssl_8k_key.result create mode 100644 mysql-test/std_data/server8k-cert.pem create mode 100644 mysql-test/std_data/server8k-key.pem create mode 100644 mysql-test/t/ssl_8k_key.test diff --git a/extra/yassl/taocrypt/src/coding.cpp b/extra/yassl/taocrypt/src/coding.cpp index 68055b3aff4..55fe31831e3 100644 --- a/extra/yassl/taocrypt/src/coding.cpp +++ b/extra/yassl/taocrypt/src/coding.cpp @@ -184,7 +184,7 @@ void Base64Decoder::Decode() { word32 bytes = coded_.size(); word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz); - plainSz = (plainSz * 3 + 3) / 4; + plainSz = ((plainSz * 3) / 4) + 3; decoded_.New(plainSz); word32 i = 0; diff --git a/mysql-test/r/ssl_8k_key.result b/mysql-test/r/ssl_8k_key.result new file mode 100644 index 00000000000..b33a1d2854f --- /dev/null +++ b/mysql-test/r/ssl_8k_key.result @@ -0,0 +1,2 @@ +Variable_name Value +Ssl_cipher DHE-RSA-AES256-SHA diff --git a/mysql-test/std_data/server8k-cert.pem b/mysql-test/std_data/server8k-cert.pem new file mode 100644 index 00000000000..a0750f9e69e --- /dev/null +++ b/mysql-test/std_data/server8k-cert.pem @@ -0,0 +1,51 @@ +-----BEGIN CERTIFICATE----- +MIIJHDCCBQQCAQEwDQYJKoZIhvcNAQEEBQAwTjELMAkGA1UEBhMCU0UxEDAOBgNV +BAgTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMQ0wCwYDVQQLEwRUZXN0MQsw +CQYDVQQDEwJDQTAeFw0wNzA3MTMwNzU2MjVaFw0xMDA0MDgwNzU2MjVaMFoxCzAJ +BgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRkwFwYDVQQKFBBNeVNRTCAgIAog +ICAgIEFCMQ0wCwYDVQQLEwRUZXN0MQ8wDQYDVQQDEwZzZXJ2ZXIwggQiMA0GCSqG +SIb3DQEBAQUAA4IEDwAwggQKAoIEAQDUFlh/3mwov5YaICFXOdJXgHV/uDkTjXB6 +9oxlipshQaYPX8LDT5vhI3gPciS1Z1sRE2dTcC4Mk2K4LDUIjp3WkeTfFAHZPV3E +Y+3OH/ftH4N6SEIBTKE4EY6ah0nJtU98M0JhxOh5zHje6zQp1SkBnhEOQYexYRqj +OtGloZ9RyF0iFAXcyu2Ap14u37l5Yla0cyPzvZqP4mFYlcXwaRfAacJmqMM1vuQv +Fx1JITUTBugMF3VGZ1F0tw63EIUH/FW/WWncPqvG18na40qlv9ZkBw0FhZeKS8cK +JIY5y4J30jn/eV8p1lTO7K+ASTuGZWmdRDgjUG0Y9OGuKsPPoaE6ml0HTnMBsBSQ +fXUq9XkwGt8DTgPioAKHBHjLbILEy4FMYWrlTZlPTzNqyhayec/2T15oDladNSt7 +JpDLpX70UECXFhdEGxsGxtXdKbIBvNm2yT4X2nxW9ItsECjSSgD+94TgGoa8QKDw +rpmgq+Wqpm54CZ1vN1oqyMUw1sjNEX/iLByHAjSALby2Kffk5cl5mnsR6d/k4jsi +c3Qsciwkd+rQt/8VMhS2ns3nkez/BK3FvQA2Ms8xJhFLfszVrBhnjcFRTNT2+/KM +lr1oT5Q1XZKL7qVXTpabPL51JlVBL5CSHl1QRkffsqfqcgJkcHBq+kKjUiFs4lad +hTrvNBCXYa5+NkA2QqIfdOpNwl62/gdE7/7zU1uh40vkVKyzL+APkLPywPEXBOpQ +yIDNkgoXmS10+JMD44K7uZyUmxZL7W7Xbi30NuEFrVOzoUmVXhapPbpQnkQHxn8n +tqKPYXdBcvXcCKyJ6i79H2Vk9fM6rBYiwNcE7QyWqfd2QMjzr76veF04sXkPR+tG +5Y1lrF9Zp3vabFXQg2RJuGA3rV6MR2GFNXuChIYu410vhIhPNtmdKEVoIVZsFsug ++dtn0PDCFrR8VEd/sshp0naNa9Ad1lY+marJkOJOVpPgCs2yJDPAUB/YdvSJ4avW +6ZdvNTwhBL8fEJMS2DSqkaa6A3+i/SqITpU8ToJxsMGagBsLieXgvJALFysSRfR/ +2dmEu9/J0PPc28inHXwjiLb99VKlkuEz8wX9UkuoqFl0pLa8jrlM8hzdPQ9QHb3k +9c5knfgPCYkOIWwGXH+NwANHdQRK7CmGAFV24k9+P3q0g5ikabVHr+4ZQ3WPd+1H +K0+Msbb/vv53vFJWa+pYeNeFcwNCyW2kJBTMiI6qmlL4IWCcX+QDzpRLalbAWWHj +l5Zk39QEaCL024DYK948IDXCqDg6utEs7YnMdaIF0meYMKjehZFp0fVQ8e8Od+rp +bbjdj/w60wMgBpSOeYxVrs3QKNZd/if4Az3LggoVHB09SjXKiWpvAgMBAAEwDQYJ +KoZIhvcNAQEEBQADggQBABncOBW0wQwJdEB6W3d9CrhFp40q1OM54GPfX0/0aUfP +aOQPxS1uCKcFhxAmR4OT9RiJx+0bhDctekkuMkj5yy3u0a/4PxHIhnVxXTyB0/Hj +N1gLz6cQricunl6Q4Ldi54gR5/KUehKLBWnqsfxhgzWBHosvhlJC0xh/uio7JTqz +ns60djyL7R4wGbSqiGdhT9L2HfpJo3dmmWLDxe02jaHkbL1Z6NQMxrRgs3+gctp/ +Wd5UxNl4BHbNsSbzaK9V9gXUcj4TjZGGSqVki0+pEZ3dmksGZdoW9cSKtzKvgUQ6 +vhhqO4dcopxkY2zYeVOpspgTm0XLZSbNPXv5rSFwa4cpWSfD7u8o8KhHvkkSMahw +cMuH17W4voHHFDtWP8Oq9rA7uE/4/LKCl0JmJl2RWM+G6PMH8w4X4auHPssgRvb/ +Ge1AvgqQJrvi7zWx3XYKKJ0ISBy7fi5Jo/wYgLagRYcG3mwdm1+gAdw+77C/ZGmG +FbWFIPB1+Mc6azhhk9m/vqP7o/Wuncc99mp2zPMzdAEzuzp/IJ9UJNat0edA7jiC +bQ7JSRJ1DSzdJZSWWHdardLNKipPfrEHVm7f5QvL5DQLnGpt+rCWL361KsGtvETC +o+Ph7+kDJsJLokUYfs/BEZopzspNPy/NQ2ECwQp7T4Yq/PBE6Ce/dFaoZysMUOrG +TcALtJW6It98dRmTJPiqjlrlHNTrfoV3Aiy+tK4rpyGuApSHc+1Y+t7YvWotRlQ4 +GEboBqR8evjDPJ1xAaUZqwLkebf3mlpl4MzHM9uNWBkQdJilkQs/IrAaApG3Ayt0 +nIymNHmDslBEdrRGmT4aNWAWYvVYzyKDy3H0fzYdWwuA9goJUL4tj3eMJa8pgEU/ +rG3HfflVi+xuwm1UnLXPSIE8hixgV8ebnwcCnEjlUBvwpl7f5Ub40jKcdycdGvVu +gcTUzuRl1+Ikfk/MXKPbdi4A5Pjtz6AG4Ez9q5j7X77JqskTI5Z/f1RPiKwFBJHg +cN4+BPnEuSWGcjiNDOfQxhk5exlWRf/gpEhnQpGHe3a7tZgfxHUb/pWU9BYpf8OH +vtV3WSDXlUqsEEH6/bmvj8lmFWJLmeZv+qLy1wHxcXR9/GJ6TwCF8niQIl3MrBAL +sKPLft1drmpqdIQpZQIJxtN/AQuD9mxEdW7XA6rkvFySKcswJpS1QjkSWpafCBWE +wu+SPxZL8oFrnNMTU3JloUjcRp70FkNXLLm/Dy+MjW2qFBtIoBgNptVGp94L1uZS +amd2XJMcOQ+X9fcH3wAdM3IHGn3NiLf6eTW92JNNA0IN6aNtyVaJKmFJ1JfXOl9r +ujr4SorRSesaerjIcuzW1u1YE5RlgeI4kizV2/D5kYc= +-----END CERTIFICATE----- diff --git a/mysql-test/std_data/server8k-key.pem b/mysql-test/std_data/server8k-key.pem new file mode 100644 index 00000000000..608593a5096 --- /dev/null +++ b/mysql-test/std_data/server8k-key.pem @@ -0,0 +1,99 @@ +-----BEGIN RSA PRIVATE KEY----- +MIISKQIBAAKCBAEA1BZYf95sKL+WGiAhVznSV4B1f7g5E41wevaMZYqbIUGmD1/C +w0+b4SN4D3IktWdbERNnU3AuDJNiuCw1CI6d1pHk3xQB2T1dxGPtzh/37R+DekhC +AUyhOBGOmodJybVPfDNCYcToecx43us0KdUpAZ4RDkGHsWEaozrRpaGfUchdIhQF +3MrtgKdeLt+5eWJWtHMj872aj+JhWJXF8GkXwGnCZqjDNb7kLxcdSSE1EwboDBd1 +RmdRdLcOtxCFB/xVv1lp3D6rxtfJ2uNKpb/WZAcNBYWXikvHCiSGOcuCd9I5/3lf +KdZUzuyvgEk7hmVpnUQ4I1BtGPThrirDz6GhOppdB05zAbAUkH11KvV5MBrfA04D +4qAChwR4y2yCxMuBTGFq5U2ZT08zasoWsnnP9k9eaA5WnTUreyaQy6V+9FBAlxYX +RBsbBsbV3SmyAbzZtsk+F9p8VvSLbBAo0koA/veE4BqGvECg8K6ZoKvlqqZueAmd +bzdaKsjFMNbIzRF/4iwchwI0gC28tin35OXJeZp7Eenf5OI7InN0LHIsJHfq0Lf/ +FTIUtp7N55Hs/wStxb0ANjLPMSYRS37M1awYZ43BUUzU9vvyjJa9aE+UNV2Si+6l +V06Wmzy+dSZVQS+Qkh5dUEZH37Kn6nICZHBwavpCo1IhbOJWnYU67zQQl2GufjZA +NkKiH3TqTcJetv4HRO/+81NboeNL5FSssy/gD5Cz8sDxFwTqUMiAzZIKF5ktdPiT +A+OCu7mclJsWS+1u124t9DbhBa1Ts6FJlV4WqT26UJ5EB8Z/J7aij2F3QXL13Ais +ieou/R9lZPXzOqwWIsDXBO0Mlqn3dkDI86++r3hdOLF5D0frRuWNZaxfWad72mxV +0INkSbhgN61ejEdhhTV7goSGLuNdL4SITzbZnShFaCFWbBbLoPnbZ9Dwwha0fFRH +f7LIadJ2jWvQHdZWPpmqyZDiTlaT4ArNsiQzwFAf2Hb0ieGr1umXbzU8IQS/HxCT +Etg0qpGmugN/ov0qiE6VPE6CcbDBmoAbC4nl4LyQCxcrEkX0f9nZhLvfydDz3NvI +px18I4i2/fVSpZLhM/MF/VJLqKhZdKS2vI65TPIc3T0PUB295PXOZJ34DwmJDiFs +Blx/jcADR3UESuwphgBVduJPfj96tIOYpGm1R6/uGUN1j3ftRytPjLG2/77+d7xS +VmvqWHjXhXMDQsltpCQUzIiOqppS+CFgnF/kA86US2pWwFlh45eWZN/UBGgi9NuA +2CvePCA1wqg4OrrRLO2JzHWiBdJnmDCo3oWRadH1UPHvDnfq6W243Y/8OtMDIAaU +jnmMVa7N0CjWXf4n+AM9y4IKFRwdPUo1yolqbwIDAQABAoIEAQDI3u0tFoWMRoCs +99d8HLiaxYED2YC9gw2QeKjal198LQhRsVnu0ByMLKLOxkX8RgrbbmxDe5Exufob +A0urciAOFJoXqoRhs5x2oEqgGmkf/ePx0jQptOFREFfnBdGeKIpC0O3DWdLxYPbt +8wixwkEXVhVDUk9pcdXf2ZqsbBpQRBvpZdtzlgNCAcLTVHP/gmMqf48CkIauVjPq +ydfybibfx4sm3hodclH+Q78p/zicb8MhiKo7ZymgCKz4N743pQe1tsLrpbPeHY0C +MpoFyF8O2Bq+KxwvELxQX+19GcHVKJhj3hmCr4wde9BxCWtGTBCusekVkVvy8iQ5 +aCmTIrtonMEVZXjJlXK0sw5hBKOmKx0jrSVC5FfgdxzNVlW4fCJXLEEpMsjMc+/3 +6bV7jqGn4N5CYaopNS2ccxdaucE3NjcmofahO6bqUTJHSPFecfYmCA42W2m+ldjj +HZ78JLkyw03nT1hjPjbwHf5FTem1KfKg4EJrDprowMT7D8KZb0SW+z59pFoDOM5u +Heu6sOSUtvpvKfozdw2ZAI58dhpW4/jTfCEtewRhPqE3/V7g3haTnQFxU8gm/a4N +uefZTCjFE16QWNuvnUrJWw/DlvOBY8GjpQCWY0mDeBHPNOI0Xg9oRTgOCrKSLUya +YSbg6BmhSKwKsYQU834jrQb3fXFlXZVIxlcNePOWMhHFFNAHucHF822Nr7u/3FOT +twcbBIOXCGfDT6ed8d4dNum1L7k9Blju16CWkfuciL8PGXY4mGAmF4nZMXGZgK8B +Cz9cxhtvFLe8gz5615DtBAsuVm7Q4AAHiULAMg6t6auyxCb8pXbAL0Ec5X4zS3+f +I2riODYiyHCh/qTtjawOzUZZEtjZRMSDi+jk8wjjDdkFU8McOaYoPyqT3TDy2v6m +NiPJs8GWQ2NCNo9CNoGbEIIFFP5iSz18XLFAOF+2dN/KHHl9nKyi7kOhYbbzoNku +2wQV40yVsrS4E/hd/7+2IB2Muduxiu7NxCUSUXsw6p0hZTYMpIoduEfRSk1al0lS +862GD8JgJ4RhJ0uIOTDJS52MQmO8zFIL86emdjjV1CzVvadYSQLTX7ZgR0i8g46A +y0muCFAC8EJpnEtHzqtQ/z22zB8TCJShFuUK9KF6K8nOlbc6ShcUXU2J6r1sc8aT +Dx0yzRXfCL15fpCJBP49EYaKhArTNmFRa2GaLiJP0OYkTrrwVOGuS6x2+kRVoP/8 +BcNMZ5x8mXP1LgotHCztgMKX30Hn5CLxbH8QfcWKemGva1jBmhCWxS17Gh3Ld9T3 +/WKkBa6JDq83rlO84x/iF3mB3tYkZPfcYtYURn5wwm/BmVV/9G1VwAatJdxmfCSy +5JwC9WDBAoICAQD7xStPk3lq+qYHAtLZidujmzSNv7XG+E8UC9yvMRFuBwSM5ZE4 +YGD2LDev2nghB+7OSR8KJIkxeaNjP91Zf3s8wjCuxLg/cLGI6mf6uWy9+zypFg3i +J+ylDKa6NBuqYyY75W7Pj63xvGQlw5kX5+mB3ulQbActT4cUiVdEkyDytzubqLzY +s15QGFrL9gqLow+C+7LKQKdeXq8OavFV1PWkMDAJUki6cIir9m+f5Mqr2cQCLKgx +38aX8c9UWJv6pI5zQQuBjpaBOwz07WnyTXiFpc71x/8i85uLGDM0e3VO5ZPGeRBj +jZ0ucHatOHJ3i/nPRG16rsPR+q97QiDHoLF0quHEG+ND+rwTBzNGIwzYRE16p1o3 +UdzFk1RzlDCfOX7QgszCwK6mf8TbCK9f/FxJ5e6TCkt3iHXSrlLS4op6k9nEpKFH +KHf4nPtCy9GriP+A8+dA6K1s+DgejoIojBMBTsnl4TEf+m8BaenTXGuU7KYyc8dR +JqmpmDggDRT/ImHRhXirY7lIIYXnI7tRjN5gmnKpEiHScT1r848zpQ4gWH1Dx/ks +mKT6NZ8nF45saQCYbKEYc0RH9Kw0O7vr1kVtNPc2dEZtVgt4bC5fnl7xX1/YTk3m ++h1qfzbku/+MX5rRjHLR2l8a71UltlnnnpP5NKBBgtxll6aCIkk6CdH8YQKCAgEA +16aBaVa0cOZmiOQwPQkpuXIbV7msz1ttWEAHElCy6waniOCON89PYFCb7F0NjV3Q +i+pGaRgG1iZGbjjHwyqTrHhMloFm+IsSWZqOZzrHgSJgA4bgTJFgp+5b31sQXGfJ +14QQSqMJLC61/M+CnrNtiuI3IVHx6BFRxI42uE7PfTyUMaFhL9F0/SLl0Mw0oMPj +S5kmarduuKpRn1tN9WO+ywEvYwopvH3e9PBssZzPpttlLiE/Wulb0iEtlVXYB9DS +Vzc94N2dzFMIvWUDF9BQ+IBMRzXRm15Psy6LfzoK+9S6w38Dx3BVV8ykSMKeW1UR +ZwTajjdnIBLdE3onD5XMmrSOPw/WtV5zXEYY4DObhIPoN2iD8GJP0IubPb6fonH5 +VHmuVZoXrroFEe7rdt2wgmBdPPl6fqvBKVhjJOpYQctrFLgWh63bXZKaBWqbQM9W +fECq8We1VN3fzqwfwJQit3z5R/DjQNk8eQx7SnnkOzAY6ZgpysHCwaoPOnPVuiYF +ZU0+X3iwfsdeefWmGEDIzoZk6nYaljs61lOhhEoWHngZHDkMOp5kg0n9f8BUP02+ +WJ4QhwzZ73hr4FPBuPHHXECw9TCAgCBHBFrnrXg5QalDhRXz4F+3tCY7UUpD/ikZ +L6Daxm5zGJ5u3rXs6WwKy2EHVVS9zfqs4Q259pQdWM8CggIAcIKpGzOVM+h033c0 +kIBZxeAq+Rlt+0+lzxiJ80RjPJ8oOmqwndf8HKaf8BcaTfCEmGz20QqIwLJSAJ1e +posgoINLTB6fE8Kho8TU2KeaX7/xWMKBS8p5pzxjGZ0Fq/wI7wVVoq3blsaQnout +U5CQujfKXeUYw/fhLp09gWiadbzKh4I9ej2V7QclNDZsegBRg0BForqH0NVRN4k0 +9h1n9IqQPOonlCGMAgTr1zFgHLIBNNOOClOtJOOruk6qzbRR8FFl+eyld3TTEnUy +PlS+gkMZnJ5WduEUZnFXGKH/R1Wy1yPs3gA/+KvLbRdnl+LWrPgwUH3fBmwXlWZ0 +zaETDEb9Ay1PP2bCO2KhWDt7lv3W/fPhjg0oMqbnO4tCuzTvZfC93l5K7h708skL +zkIxX9i/57fXB8DUnmTGoHUaWzLNQ2IqrGj6TACjDDOXLCfZvl/AvTH9pk+6jHU0 +1zfZmmECOpeK43Z/ussA8jI/5Vpn3u38aVh0w1RB6JjQBD/yJLaXuUekWgaZFzTR +ldz014jNqp5uvONcBmzeVr7w9CV3PR4VTQed2i6yQ770J6A44uTQjOOd5OYDOohj +Lz4e4nGj9BK8Eko8cAEwLAzS8tyjMT+08n5dPOVCu68DwVBMGE7CVONYUuoXS/YU +cTxddiU9ZGk9Yq0FfOwjeys+SqECggIAdn3M2b6Egwx2Bn2ra74fKQBjub4SEBWi +bT0xJYUl6jHL2E/alRvZ94gTRLqUebq0nkxpx9El4IFDbcjRKpG4dqnbG0+a7rIr +sQRVfq8zc+cZbparpCa1P1CfNojo4n080KiF8xzGK3q3EGRM1zqr1AYcWLiX/PWX +QjMKKhdTtvKUUvjjV8z1RSnpsOKjgDpiJ+XM0BJeSiV7l94pZc4axZyvFvI8oI9g +9KEueCE7j+k5HTGziBZ1F26Xh1iVzSWWjcmSvH3I+L4fLUHVgz45X3HPd8lAlOgr +Tr8icxPHeTwYKtcdknZMzmNpWXlmXbTOTRbDqCUVCvCSfOM/lzauJ8tR5aCkTx/I +r0js3jQ9HYEFFXzeEjVSubob4L9fI3kQkLQTcIGsxZr8si/fPX7uP5UHZjuGbRee +mUMxptUFDZHiEo5cAs0qna2x54v+JoxGbxtxUhez8R/Am+TDxaMfuEZ5Cmh31egH +bFPJYtC68TKqXZ/4RqpUgukYWPvQ0emWSWU6AmdkQyT06nppeyYNsDz0MkgWr7l3 +yNBHDVNP+Anxcip+Z68kd2cuXQWmxOnIzxR67FnJXeWDEM20whRHgI8jLHYsBTq3 +CtOQPSaz/zosGXJIgF7Xp6riKPZvibW3Ww49Z47EuyBCtyirNk7hV4LG7sITUJyO +ZVKPfcdAoM0CggIBANz3EBZGyt3af2UjFFKbazV01KcHF8OxqdQzsLqHCXWb98V6 +PggQnrF76U7DvqOWho9djDBPrbQU55HG5nXq+eZKPwhsOdwQ8bxOhaVxQcATZOI7 +FtJYnjM1/+zMzzS0iPR5DA2pbB3AKH2Z+wODmF23CK2XTwoJyPKxvlyGKrIqq3gN +kOmocNu2Qm5bJf+D/hYPm5Ust2wzD52NnvJU536bZ0ZMo1/kaK2idqSAzqo4TkR1 +j9U0fdW2rIBDo/qFmBBdJhYVjYLj4qR8CEEoIjshD4Nztf1xRM5C8irE/gJcT5+r +4bPJJ5TjAtHxPiQqZruSprSEUbMsPqBap64ow0SmbNNWSgyaz2ha1rG0p52NBzH4 +XM52LBqS9QHPHvB0ooYfBTfPpDM3CePuuNyzjPAw86ncUo38FKXuc2oViJJ6C5I7 +v2sKhLK5gu3uPBB2ludDEXSpWBqiraynolOT/o52r+taYp9YY2WU3GrhOiV/A1FV +Nl118xiF6FOFpEeTbhHvy27A8kZEKXgeSs+f4aC0XG9kLVD1CiCbQiqHTDcDS4nV +O1N1eQxhP81X+YKE4Lgufh07REqYVwtCj2lQcMp73WDyfBLKTEFlmHusoqmT5JCH +X0BWNjk5Dn1g5h63/lQb+EjNRILBhDFYhrDRDQtw5p0/7IY3AcNKDUHv+XGn +-----END RSA PRIVATE KEY----- diff --git a/mysql-test/t/ssl_8k_key.test b/mysql-test/t/ssl_8k_key.test new file mode 100644 index 00000000000..b4203e68445 --- /dev/null +++ b/mysql-test/t/ssl_8k_key.test @@ -0,0 +1,6 @@ +-- source include/have_ssl.inc +# +# Bug#29784 YaSSL assertion failure when reading 8k key. +# +--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1 + From 6947f2d1316c7b0b7ede841a097328da8c21aa4d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Jul 2007 12:13:45 +0500 Subject: [PATCH 02/49] Fix for bug #28125: ERROR 2013 when adding index. Problem: we may break a multibyte char sequence using a key reduced to maximum allowed length for a storage engine (that leads to failed assertion in the innodb code, see also #17530). Fix: align truncated key length to multibyte char boundary. mysql-test/r/innodb_mysql.result: Fix for bug #28125: ERROR 2013 when adding index. - test result. mysql-test/t/innodb_mysql.test: Fix for bug #28125: ERROR 2013 when adding index. - test case. sql/sql_table.cc: Fix for bug #28125: ERROR 2013 when adding index. - align truncated key length to multibyte char boundary. - display real key length in bytes raising warnings. --- mysql-test/r/innodb_mysql.result | 14 +++++++++++++- mysql-test/t/innodb_mysql.test | 9 +++++++++ sql/sql_table.cc | 6 ++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 4535710c905..4c1e7189998 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -418,7 +418,7 @@ DROP TABLE t1,t2; create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb character set utf8 collate utf8_general_ci; Warnings: -Warning 1071 Specified key was too long; max key length is 765 bytes +Warning 1071 Specified key was too long; max key length is 767 bytes insert into t1 values('aaa'); drop table t1; CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB; @@ -735,4 +735,16 @@ COUNT(*) 3072 set @@sort_buffer_size=default; DROP TABLE t1,t2; +create table t1(a text) engine=innodb default charset=utf8; +insert into t1 values('aaa'); +alter table t1 add index(a(1024)); +Warnings: +Warning 1071 Specified key was too long; max key length is 767 bytes +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text, + KEY `a` (`a`(255)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +drop table t1; End of 5.0 tests diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index d4ce997ddb1..4930ec81a62 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -741,4 +741,13 @@ set @@sort_buffer_size=default; DROP TABLE t1,t2; +# +# Bug #28125: ERROR 2013 when adding index. +# +create table t1(a text) engine=innodb default charset=utf8; +insert into t1 values('aaa'); +alter table t1 add index(a(1024)); +show create table t1; +drop table t1; + --echo End of 5.0 tests diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 87f23097a66..0da639f9896 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1357,6 +1357,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, length); push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_TOO_LONG_KEY, warn_buff); + /* Align key length to multibyte char boundary */ + length-= length % sql_field->charset->mbmaxlen; } else { @@ -1387,8 +1389,6 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, if (length > file->max_key_part_length() && key->type != Key::FULLTEXT) { length= file->max_key_part_length(); - /* Align key length to multibyte char boundary */ - length-= length % sql_field->charset->mbmaxlen; if (key->type == Key::MULTIPLE) { /* not a critical problem */ @@ -1397,6 +1397,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, length); push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_TOO_LONG_KEY, warn_buff); + /* Align key length to multibyte char boundary */ + length-= length % sql_field->charset->mbmaxlen; } else { From 8b8b430bbccc01717e3eb50e4e452cf415292d00 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Jul 2007 14:03:58 -0400 Subject: [PATCH 03/49] Bug#26909: Specified key was too long; max key length is 255 bytes \ when creating table Federated tables had an artificially low maximum of key length, because the handler failed to implement a method to return it and the default value is taked from the prototype handler. Now, implement that method and return the maximum possible key length, which is that of InnoDB. mysql-test/r/federated.result: Verify that unique keys may be longer than 255 characters. mysql-test/t/federated.test: Verify that unique keys may be longer than 255 characters. sql/ha_federated.h: Implement the virtual method that tells the max size of parts to make a key. Backport the length defined in 5.1. --- mysql-test/r/federated.result | 37 ++++++++++++++++++++++++++++++++ mysql-test/t/federated.test | 40 +++++++++++++++++++++++++++++++++++ sql/ha_federated.h | 4 +++- 3 files changed, 80 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index cecffbb1471..b69ff8033d4 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -1843,6 +1843,43 @@ C3A4C3B6C3BCC39F D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E drop table federated.t1; drop table federated.t1; +CREATE TABLE federated.t1 ( +categoryId int(11) NOT NULL AUTO_INCREMENT, +domainId varchar(745) NOT NULL DEFAULT '', +categoryName varchar(255) NOT NULL DEFAULT '', +PRIMARY KEY (categoryId), +UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), +KEY idx_category_domainId (domainId) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +CREATE TABLE federated.t1 ( +categoryId int(11) NOT NULL AUTO_INCREMENT, +domainId varchar(745) NOT NULL DEFAULT '', +categoryName varchar(255) NOT NULL DEFAULT '', +PRIMARY KEY (categoryId), +UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), +KEY idx_category_domainId (domainId) +) ENGINE=FEDERATED DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +insert into federated.t1 (domainId, categoryName) values ( '1231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231 300', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 250'); +insert into federated.t1 (domainId, categoryName) values ( '12312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312 301', '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 250'); +insert into federated.t1 (domainId, categoryName) values ('a', 'b'); +select categoryId from federated.t1 order by domainId, categoryName; +categoryId +1 +2 +3 +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +categoryId +3 +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +categoryId +3 +select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' order by categoryId; +categoryId +1 +2 +drop table federated.t1; +drop table federated.t1; DROP TABLE IF EXISTS federated.t1; DROP DATABASE IF EXISTS federated; DROP TABLE IF EXISTS federated.t1; diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index 894cd513914..e3c7d478c78 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -1575,5 +1575,45 @@ drop table federated.t1; connection slave; drop table federated.t1; +# +# Bug#26909: Specified key was too long; max key length is 255 bytes +# when creating a table +# +connection slave; +CREATE TABLE federated.t1 ( + categoryId int(11) NOT NULL AUTO_INCREMENT, + domainId varchar(745) NOT NULL DEFAULT '', + categoryName varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (categoryId), + UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), + KEY idx_category_domainId (domainId) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + categoryId int(11) NOT NULL AUTO_INCREMENT, + domainId varchar(745) NOT NULL DEFAULT '', + categoryName varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (categoryId), + UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), + KEY idx_category_domainId (domainId) + ) ENGINE=FEDERATED DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + + +insert into federated.t1 (domainId, categoryName) values ( '1231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231 300', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 250'); +insert into federated.t1 (domainId, categoryName) values ( '12312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312 301', '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 250'); +insert into federated.t1 (domainId, categoryName) values ('a', 'b'); + +select categoryId from federated.t1 order by domainId, categoryName; +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' order by categoryId; + +drop table federated.t1; + +connection slave; +drop table federated.t1; source include/federated_cleanup.inc; diff --git a/sql/ha_federated.h b/sql/ha_federated.h index 09c934cb493..9f24e92357c 100644 --- a/sql/ha_federated.h +++ b/sql/ha_federated.h @@ -37,6 +37,7 @@ #define FEDERATED_QUERY_BUFFER_SIZE STRING_BUFFER_USUAL_SIZE * 5 #define FEDERATED_RECORDS_IN_RANGE 2 +#define FEDERATED_MAX_KEY_LENGTH 3500 // Same as innodb #define FEDERATED_INFO " SHOW TABLE STATUS LIKE " #define FEDERATED_INFO_LEN sizeof(FEDERATED_INFO) #define FEDERATED_SELECT "SELECT " @@ -217,7 +218,8 @@ public: uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; } uint max_supported_keys() const { return MAX_KEY; } uint max_supported_key_parts() const { return MAX_REF_PARTS; } - uint max_supported_key_length() const { return MAX_KEY_LENGTH; } + uint max_supported_key_length() const { return FEDERATED_MAX_KEY_LENGTH; } + uint max_supported_key_part_length() const { return FEDERATED_MAX_KEY_LENGTH; } /* Called in test_quick_select to determine if indexes should be used. Normally, we need to know number of blocks . For federated we need to From 28ec0efcb6810c98af5bfbeeaaf0bfa13343a874 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Jul 2007 11:23:38 +0500 Subject: [PATCH 04/49] Fixed #29923: federated.test fails in 5.0-maint, 5.1-maint Result adjusted. mysql-test/r/federated.result: Fixed #29923: federated.test fails in 5.0-maint, 5.1-maint - result adjusted. --- mysql-test/r/federated.result | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index 076e165b21e..56522ba2f50 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -1878,6 +1878,8 @@ select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' or categoryId 1 2 +drop table federated.t1; +drop table federated.t1; create table federated.t1 (a int primary key, b varchar(64)) DEFAULT CHARSET=utf8; create table federated.t1 (a int primary key, b varchar(64)) From 3d2675ec3ecbe04e5f555b446858fa8ac78536e0 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Jul 2007 15:37:42 +0500 Subject: [PATCH 05/49] after-merge fixup --- mysql-test/r/innodb_mysql.result | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index f44ce5b5122..a7f6b0ad9d7 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -735,6 +735,10 @@ COUNT(*) 3072 set @@sort_buffer_size=default; DROP TABLE t1,t2; +drop table if exists t1; +create table t1 (a int) engine=innodb; +alter table t1 alter a set default 1; +drop table t1; create table t1(a text) engine=innodb default charset=utf8; insert into t1 values('aaa'); alter table t1 add index(a(1024)); @@ -746,8 +750,5 @@ t1 CREATE TABLE `t1` ( `a` text, KEY `a` (`a`(255)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 -drop table if exists t1; -create table t1 (a int) engine=innodb; -alter table t1 alter a set default 1; drop table t1; End of 5.0 tests From 04fc8b71d66810df6784876d58fe3a5e534b2ac4 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 Jul 2007 16:23:35 -0600 Subject: [PATCH 06/49] Bug#29959 (Non-standard bison syntax in sql_yacc.yy) In sql/sql_yacc.yy, use the %prec construct at the end of rule join_table sql/sql_yacc.yy: In sql/sql_yacc.yy, use the %prec construct at the end of rule join_table --- sql/sql_yacc.yy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 6fbd521e302..d71e756e91c 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -5567,7 +5567,7 @@ join_table: so that [INNER | CROSS] JOIN is properly nested as other left-associative joins. */ - table_ref %prec TABLE_REF_PRIORITY normal_join table_ref + table_ref normal_join table_ref %prec TABLE_REF_PRIORITY { MYSQL_YYABORT_UNLESS($1 && ($$=$3)); } | table_ref STRAIGHT_JOIN table_factor { MYSQL_YYABORT_UNLESS($1 && ($$=$3)); $3->straight=1; } From 78207030bb8f5dde7d5a0d3e6b84b099b4a8dfba Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Jul 2007 21:31:25 -0700 Subject: [PATCH 07/49] Updated/fixed test and result files to 5.0.46 Note datadict files do not include wrong is_updatable wrong value as a result of bug 30020. mysql-test/suite/funcs_1/datadict/datadict_master.inc: Updated test file mysql-test/suite/funcs_1/r/innodb__datadict.result: Updated test file mysql-test/suite/funcs_1/r/innodb_func_view.result: Updated test file mysql-test/suite/funcs_1/r/innodb_trig_0102.result: Updated test file mysql-test/suite/funcs_1/r/innodb_trig_08.result: Updated test file mysql-test/suite/funcs_1/r/innodb_trig_09.result: Updated test file mysql-test/suite/funcs_1/r/innodb_views.result: Updated test file mysql-test/suite/funcs_1/r/memory__datadict.result: Updated test file mysql-test/suite/funcs_1/r/memory_func_view.result: Updated test file mysql-test/suite/funcs_1/r/memory_trig_0102.result: Updated test file mysql-test/suite/funcs_1/r/memory_trig_08.result: Updated test file mysql-test/suite/funcs_1/r/memory_trig_09.result: Updated test file mysql-test/suite/funcs_1/r/memory_views.result: Updated test file mysql-test/suite/funcs_1/r/myisam__datadict.result: Updated test file mysql-test/suite/funcs_1/r/myisam_func_view.result: Updated test file mysql-test/suite/funcs_1/r/myisam_trig_0102.result: Updated test file mysql-test/suite/funcs_1/r/myisam_trig_08.result: Updated test file mysql-test/suite/funcs_1/r/myisam_trig_09.result: Updated test file mysql-test/suite/funcs_1/r/myisam_views.result: Updated test file mysql-test/suite/funcs_1/triggers/triggers_0102.inc: Updated test file mysql-test/suite/funcs_1/views/func_view.inc: Updated test file --- .../funcs_1/datadict/datadict_master.inc | 15 +- .../suite/funcs_1/r/innodb__datadict.result | 3 +- .../suite/funcs_1/r/innodb_func_view.result | 332 +++++++----------- .../suite/funcs_1/r/innodb_trig_0102.result | 2 +- .../suite/funcs_1/r/innodb_trig_08.result | 5 +- .../suite/funcs_1/r/innodb_trig_09.result | 2 +- .../suite/funcs_1/r/innodb_views.result | 3 +- .../suite/funcs_1/r/memory__datadict.result | 3 +- .../suite/funcs_1/r/memory_func_view.result | 332 +++++++----------- .../suite/funcs_1/r/memory_trig_0102.result | 2 +- .../suite/funcs_1/r/memory_trig_08.result | 5 +- .../suite/funcs_1/r/memory_trig_09.result | 2 +- .../suite/funcs_1/r/memory_views.result | 3 +- .../suite/funcs_1/r/myisam__datadict.result | 3 +- .../suite/funcs_1/r/myisam_func_view.result | 332 +++++++----------- .../suite/funcs_1/r/myisam_trig_0102.result | 2 +- .../suite/funcs_1/r/myisam_trig_08.result | 5 +- .../suite/funcs_1/r/myisam_trig_09.result | 2 +- .../suite/funcs_1/r/myisam_views.result | 3 +- .../suite/funcs_1/triggers/triggers_0102.inc | 2 +- mysql-test/suite/funcs_1/views/func_view.inc | 3 +- 21 files changed, 402 insertions(+), 659 deletions(-) diff --git a/mysql-test/suite/funcs_1/datadict/datadict_master.inc b/mysql-test/suite/funcs_1/datadict/datadict_master.inc index 03d3eeb3777..2c8ceb4e68e 100644 --- a/mysql-test/suite/funcs_1/datadict/datadict_master.inc +++ b/mysql-test/suite/funcs_1/datadict/datadict_master.inc @@ -437,19 +437,23 @@ eval SELECT * # check also with a 'simple' user CREATE USER user_3212@localhost; GRANT ALL ON db_datadict.* TO user_3212@localhost; +# OBN: The following line was added following the fix to bug 28181 +# where queries to information_schema will fail if exporting to +# a file without having the FILE attribute +GRANT FILE ON *.* TO user_3212@localhost; + --replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK connect (u3212,localhost,user_3212,,db_datadict); --source suite/funcs_1/include/show_connection.inc # no db given --> db_datadict.schema does not exist ---error 1045 +--error 1146 eval SELECT * INTO OUTFILE '../tmp/out.$ENGINE_TYPE.user.file' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM schemata LIMIT 0, 5; -# FIXME 3.2.1.2: why do we get different error numbers with and without OUTFILE ? --error 1146 eval SELECT * FROM schemata LIMIT 0, 5; @@ -460,8 +464,6 @@ eval SELECT * LINES TERMINATED BY '\n' FROM information_schema.schemata WHERE schema_name LIKE 'db_%'; -# The above will fail with access error as long as -# BUBG#28181 - a regression introduced in 5.0.42 is not fixed eval SELECT * FROM information_schema.schemata @@ -469,14 +471,11 @@ eval SELECT * USE information_schema; -# no db given --> db_datadict.schema does not exist eval SELECT * INTO OUTFILE '../tmp/out.$ENGINE_TYPE.user_2.file' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM schemata LIMIT 0, 5; -# The above will fail with access error as long as -# BUBG#28181 - a regression introduced in 5.0.42 is not fixed eval SELECT * FROM schemata LIMIT 0, 5; @@ -487,8 +486,6 @@ eval SELECT * LINES TERMINATED BY '\n' FROM information_schema.schemata WHERE schema_name LIKE 'db_%'; -# The above will fail with access error as long as -# BUBG#28181 - a regression introduced in 5.0.42 is not fixed eval SELECT * FROM information_schema.schemata diff --git a/mysql-test/suite/funcs_1/r/innodb__datadict.result b/mysql-test/suite/funcs_1/r/innodb__datadict.result index 675f30da14a..bbaef83ea59 100644 --- a/mysql-test/suite/funcs_1/r/innodb__datadict.result +++ b/mysql-test/suite/funcs_1/r/innodb__datadict.result @@ -4859,6 +4859,7 @@ INTO OUTFILE '../tmp/out.innodb.db.file' WHERE schema_name LIKE 'db_%'; CREATE USER user_3212@localhost; GRANT ALL ON db_datadict.* TO user_3212@localhost; +GRANT FILE ON *.* TO user_3212@localhost; connect(localhost,user_3212,,db_datadict,MYSQL_PORT,MYSQL_SOCK); user_3212@localhost db_datadict @@ -4867,7 +4868,7 @@ INTO OUTFILE '../tmp/out.innodb.user.file' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM schemata LIMIT 0, 5; -ERROR 28000: Access denied for user 'user_3212'@'localhost' (using password: NO) +ERROR 42S02: Table 'db_datadict.schemata' doesn't exist SELECT * FROM schemata LIMIT 0, 5; ERROR 42S02: Table 'db_datadict.schemata' doesn't exist diff --git a/mysql-test/suite/funcs_1/r/innodb_func_view.result b/mysql-test/suite/funcs_1/r/innodb_func_view.result index 5fac88b8f14..f901bcf8246 100644 --- a/mysql-test/suite/funcs_1/r/innodb_func_view.result +++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result @@ -2400,16 +2400,10 @@ my_time, id FROM t1_values WHERE select_id = 89 OR select_id IS NULL; CAST(my_time AS UNSIGNED INTEGER) my_time id NULL NULL 1 -18446744073709550778 -838:59:59 2 -838 838:59:59 3 -13 13:00:00 4 -10 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '-838:59:59' -Warning 1105 Cast to unsigned converted negative integer to it's positive complement -Warning 1292 Truncated incorrect INTEGER value: '838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '13:00:00' -Warning 1292 Truncated incorrect INTEGER value: '10:00:00' +18446744073701165657 -838:59:59 2 +8385959 838:59:59 3 +130000 13:00:00 4 +100000 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as unsigned) AS `CAST(my_time AS UNSIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` @@ -2418,16 +2412,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 89 OR select_id IS NULL); CAST(my_time AS UNSIGNED INTEGER) my_time id NULL NULL 1 -18446744073709550778 -838:59:59 2 -838 838:59:59 3 -13 13:00:00 4 -10 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '-838:59:59' -Warning 1105 Cast to unsigned converted negative integer to it's positive complement -Warning 1292 Truncated incorrect INTEGER value: '838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '13:00:00' -Warning 1292 Truncated incorrect INTEGER value: '10:00:00' +18446744073701165657 -838:59:59 2 +8385959 838:59:59 3 +130000 13:00:00 4 +100000 10:00:00 5 DROP VIEW v1; @@ -2438,16 +2426,10 @@ my_timestamp, id FROM t1_values WHERE select_id = 88 OR select_id IS NULL; CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 -1970 1970-01-01 03:00:01 2 -2038 2038-01-01 02:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01' -Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +19700101030001 1970-01-01 03:00:01 2 +20380101025959 2038-01-01 02:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as unsigned) AS `CAST(my_timestamp AS UNSIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` @@ -2456,16 +2438,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 88 OR select_id IS NULL); CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 -1970 1970-01-01 03:00:01 2 -2038 2038-01-01 02:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01' -Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +19700101030001 1970-01-01 03:00:01 2 +20380101025959 2038-01-01 02:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 DROP VIEW v1; @@ -2476,15 +2452,10 @@ my_date, id FROM t1_values WHERE select_id = 87 OR select_id IS NULL; CAST(my_date AS UNSIGNED INTEGER) my_date id NULL NULL 1 -1 0001-01-01 2 -9999 9999-12-31 3 -2004 2004-02-29 4 -2005 2005-06-28 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28' +10101 0001-01-01 2 +99991231 9999-12-31 3 +20040229 2004-02-29 4 +20050628 2005-06-28 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as unsigned) AS `CAST(my_date AS UNSIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` @@ -2493,15 +2464,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 87 OR select_id IS NULL); CAST(my_date AS UNSIGNED INTEGER) my_date id NULL NULL 1 -1 0001-01-01 2 -9999 9999-12-31 3 -2004 2004-02-29 4 -2005 2005-06-28 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28' +10101 0001-01-01 2 +99991231 9999-12-31 3 +20040229 2004-02-29 4 +20050628 2005-06-28 5 DROP VIEW v1; @@ -2512,15 +2478,10 @@ my_datetime, id FROM t1_values WHERE select_id = 86 OR select_id IS NULL; CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id NULL NULL 1 -1 0001-01-01 00:00:00 2 -9999 9999-12-31 23:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +10101000000 0001-01-01 00:00:00 2 +99991231235959 9999-12-31 23:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as unsigned) AS `CAST(my_datetime AS UNSIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` @@ -2529,15 +2490,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 86 OR select_id IS NULL); CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id NULL NULL 1 -1 0001-01-01 00:00:00 2 -9999 9999-12-31 23:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +10101000000 0001-01-01 00:00:00 2 +99991231235959 9999-12-31 23:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 DROP VIEW v1; @@ -2780,15 +2736,10 @@ my_time, id FROM t1_values WHERE select_id = 78 OR select_id IS NULL; CAST(my_time AS SIGNED INTEGER) my_time id NULL NULL 1 --838 -838:59:59 2 -838 838:59:59 3 -13 13:00:00 4 -10 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '-838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '13:00:00' -Warning 1292 Truncated incorrect INTEGER value: '10:00:00' +-8385959 -838:59:59 2 +8385959 838:59:59 3 +130000 13:00:00 4 +100000 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as signed) AS `CAST(my_time AS SIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` @@ -2797,15 +2748,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 78 OR select_id IS NULL); CAST(my_time AS SIGNED INTEGER) my_time id NULL NULL 1 --838 -838:59:59 2 -838 838:59:59 3 -13 13:00:00 4 -10 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '-838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '13:00:00' -Warning 1292 Truncated incorrect INTEGER value: '10:00:00' +-8385959 -838:59:59 2 +8385959 838:59:59 3 +130000 13:00:00 4 +100000 10:00:00 5 DROP VIEW v1; @@ -2816,16 +2762,10 @@ my_timestamp, id FROM t1_values WHERE select_id = 77 OR select_id IS NULL; CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 -1970 1970-01-01 03:00:01 2 -2038 2038-01-01 02:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01' -Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +19700101030001 1970-01-01 03:00:01 2 +20380101025959 2038-01-01 02:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as signed) AS `CAST(my_timestamp AS SIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` @@ -2834,16 +2774,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 77 OR select_id IS NULL); CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 -1970 1970-01-01 03:00:01 2 -2038 2038-01-01 02:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01' -Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +19700101030001 1970-01-01 03:00:01 2 +20380101025959 2038-01-01 02:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 DROP VIEW v1; @@ -2854,15 +2788,10 @@ my_date, id FROM t1_values WHERE select_id = 76 OR select_id IS NULL; CAST(my_date AS SIGNED INTEGER) my_date id NULL NULL 1 -1 0001-01-01 2 -9999 9999-12-31 3 -2004 2004-02-29 4 -2005 2005-06-28 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28' +10101 0001-01-01 2 +99991231 9999-12-31 3 +20040229 2004-02-29 4 +20050628 2005-06-28 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as signed) AS `CAST(my_date AS SIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` @@ -2871,15 +2800,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 76 OR select_id IS NULL); CAST(my_date AS SIGNED INTEGER) my_date id NULL NULL 1 -1 0001-01-01 2 -9999 9999-12-31 3 -2004 2004-02-29 4 -2005 2005-06-28 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28' +10101 0001-01-01 2 +99991231 9999-12-31 3 +20040229 2004-02-29 4 +20050628 2005-06-28 5 DROP VIEW v1; @@ -2890,15 +2814,10 @@ my_datetime, id FROM t1_values WHERE select_id = 75 OR select_id IS NULL; CAST(my_datetime AS SIGNED INTEGER) my_datetime id NULL NULL 1 -1 0001-01-01 00:00:00 2 -9999 9999-12-31 23:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +10101000000 0001-01-01 00:00:00 2 +99991231235959 9999-12-31 23:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as signed) AS `CAST(my_datetime AS SIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` @@ -2907,15 +2826,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 75 OR select_id IS NULL); CAST(my_datetime AS SIGNED INTEGER) my_datetime id NULL NULL 1 -1 0001-01-01 00:00:00 2 -9999 9999-12-31 23:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +10101000000 0001-01-01 00:00:00 2 +99991231235959 9999-12-31 23:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 DROP VIEW v1; @@ -2926,8 +2840,8 @@ my_decimal, id FROM t1_values WHERE select_id = 74 OR select_id IS NULL; CAST(my_decimal AS SIGNED INTEGER) my_decimal id NULL NULL 1 --10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2 -10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3 +-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2 +9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3 0 0.000000000000000000000000000000 4 -1 -1.000000000000000000000000000000 5 Warnings: @@ -2941,8 +2855,8 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 74 OR select_id IS NULL); CAST(my_decimal AS SIGNED INTEGER) my_decimal id NULL NULL 1 --10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2 -10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3 +-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2 +9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3 0 0.000000000000000000000000000000 4 -1 -1.000000000000000000000000000000 5 Warnings: @@ -3115,12 +3029,12 @@ Warning 1292 Truncated incorrect INTEGER value: ' --- DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL(37,2)), my_year, id FROM t1_values; -SELECT CAST(my_year AS DECIMAL), +SELECT CAST(my_year AS DECIMAL(37,2)), my_year, id FROM t1_values WHERE select_id = 68 OR select_id IS NULL; -CAST(my_year AS DECIMAL) my_year id +CAST(my_year AS DECIMAL(37,2)) my_year id NULL NULL 1 1901.00 1901 2 2155.00 2155 3 @@ -3128,11 +3042,11 @@ NULL NULL 1 2005.00 2005 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal) AS `CAST(my_year AS DECIMAL)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal(37,2)) AS `CAST(my_year AS DECIMAL(37,2))`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 68 OR select_id IS NULL); -CAST(my_year AS DECIMAL) my_year id +CAST(my_year AS DECIMAL(37,2)) my_year id NULL NULL 1 1901.00 1901 2 2155.00 2155 3 @@ -3141,12 +3055,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL(37,2)), my_time, id FROM t1_values; -SELECT CAST(my_time AS DECIMAL), +SELECT CAST(my_time AS DECIMAL(37,2)), my_time, id FROM t1_values WHERE select_id = 67 OR select_id IS NULL; -CAST(my_time AS DECIMAL) my_time id +CAST(my_time AS DECIMAL(37,2)) my_time id NULL NULL 1 -8385959.00 -838:59:59 2 8385959.00 838:59:59 3 @@ -3154,11 +3068,11 @@ NULL NULL 1 100000.00 10:00:00 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal) AS `CAST(my_time AS DECIMAL)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal(37,2)) AS `CAST(my_time AS DECIMAL(37,2))`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 67 OR select_id IS NULL); -CAST(my_time AS DECIMAL) my_time id +CAST(my_time AS DECIMAL(37,2)) my_time id NULL NULL 1 -8385959.00 -838:59:59 2 8385959.00 838:59:59 3 @@ -3167,12 +3081,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL(37,2)), my_timestamp, id FROM t1_values; -SELECT CAST(my_timestamp AS DECIMAL), +SELECT CAST(my_timestamp AS DECIMAL(37,2)), my_timestamp, id FROM t1_values WHERE select_id = 66 OR select_id IS NULL; -CAST(my_timestamp AS DECIMAL) my_timestamp id +CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id 0.00 0000-00-00 00:00:00 1 19700101030001.00 1970-01-01 03:00:01 2 20380101025959.00 2038-01-01 02:59:59 3 @@ -3180,11 +3094,11 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id 20050628100000.00 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal) AS `CAST(my_timestamp AS DECIMAL)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal(37,2)) AS `CAST(my_timestamp AS DECIMAL(37,2))`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 66 OR select_id IS NULL); -CAST(my_timestamp AS DECIMAL) my_timestamp id +CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id 0.00 0000-00-00 00:00:00 1 19700101030001.00 1970-01-01 03:00:01 2 20380101025959.00 2038-01-01 02:59:59 3 @@ -3193,12 +3107,12 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL(37,2)), my_date, id FROM t1_values; -SELECT CAST(my_date AS DECIMAL), +SELECT CAST(my_date AS DECIMAL(37,2)), my_date, id FROM t1_values WHERE select_id = 65 OR select_id IS NULL; -CAST(my_date AS DECIMAL) my_date id +CAST(my_date AS DECIMAL(37,2)) my_date id NULL NULL 1 10101.00 0001-01-01 2 99991231.00 9999-12-31 3 @@ -3206,11 +3120,11 @@ NULL NULL 1 20050628.00 2005-06-28 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal) AS `CAST(my_date AS DECIMAL)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal(37,2)) AS `CAST(my_date AS DECIMAL(37,2))`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 65 OR select_id IS NULL); -CAST(my_date AS DECIMAL) my_date id +CAST(my_date AS DECIMAL(37,2)) my_date id NULL NULL 1 10101.00 0001-01-01 2 99991231.00 9999-12-31 3 @@ -3219,12 +3133,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL(37,2)), my_datetime, id FROM t1_values; -SELECT CAST(my_datetime AS DECIMAL), +SELECT CAST(my_datetime AS DECIMAL(37,2)), my_datetime, id FROM t1_values WHERE select_id = 64 OR select_id IS NULL; -CAST(my_datetime AS DECIMAL) my_datetime id +CAST(my_datetime AS DECIMAL(37,2)) my_datetime id NULL NULL 1 10101000000.00 0001-01-01 00:00:00 2 99991231235959.00 9999-12-31 23:59:59 3 @@ -3232,11 +3146,11 @@ NULL NULL 1 20050628100000.00 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal) AS `CAST(my_datetime AS DECIMAL)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal(37,2)) AS `CAST(my_datetime AS DECIMAL(37,2))`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 64 OR select_id IS NULL); -CAST(my_datetime AS DECIMAL) my_datetime id +CAST(my_datetime AS DECIMAL(37,2)) my_datetime id NULL NULL 1 10101000000.00 0001-01-01 00:00:00 2 99991231235959.00 9999-12-31 23:59:59 3 @@ -3245,12 +3159,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL(37,2)), my_decimal, id FROM t1_values; -SELECT CAST(my_decimal AS DECIMAL), +SELECT CAST(my_decimal AS DECIMAL(37,2)), my_decimal, id FROM t1_values WHERE select_id = 63 OR select_id IS NULL; -CAST(my_decimal AS DECIMAL) my_decimal id +CAST(my_decimal AS DECIMAL(37,2)) my_decimal id NULL NULL 1 -10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2 10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3 @@ -3258,11 +3172,11 @@ NULL NULL 1 -1.00 -1.000000000000000000000000000000 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal) AS `CAST(my_decimal AS DECIMAL)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal(37,2)) AS `CAST(my_decimal AS DECIMAL(37,2))`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 63 OR select_id IS NULL); -CAST(my_decimal AS DECIMAL) my_decimal id +CAST(my_decimal AS DECIMAL(37,2)) my_decimal id NULL NULL 1 -10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2 10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3 @@ -3271,12 +3185,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL(37,2)), my_bigint, id FROM t1_values; -SELECT CAST(my_bigint AS DECIMAL), +SELECT CAST(my_bigint AS DECIMAL(37,2)), my_bigint, id FROM t1_values WHERE select_id = 62 OR select_id IS NULL; -CAST(my_bigint AS DECIMAL) my_bigint id +CAST(my_bigint AS DECIMAL(37,2)) my_bigint id NULL NULL 1 -9223372036854775808.00 -9223372036854775808 2 9223372036854775807.00 9223372036854775807 3 @@ -3284,11 +3198,11 @@ NULL NULL 1 -1.00 -1 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal) AS `CAST(my_bigint AS DECIMAL)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal(37,2)) AS `CAST(my_bigint AS DECIMAL(37,2))`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 62 OR select_id IS NULL); -CAST(my_bigint AS DECIMAL) my_bigint id +CAST(my_bigint AS DECIMAL(37,2)) my_bigint id NULL NULL 1 -9223372036854775808.00 -9223372036854775808 2 9223372036854775807.00 9223372036854775807 3 @@ -3297,12 +3211,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)), my_varbinary_1000, id FROM t1_values; -SELECT CAST(my_varbinary_1000 AS DECIMAL), +SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)), my_varbinary_1000, id FROM t1_values WHERE select_id = 61 OR select_id IS NULL; -CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id +CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 @@ -3315,11 +3229,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal) AS `CAST(my_varbinary_1000 AS DECIMAL)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 61 OR select_id IS NULL); -CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id +CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 @@ -3333,12 +3247,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL(37,2)), my_binary_30, id FROM t1_values; -SELECT CAST(my_binary_30 AS DECIMAL), +SELECT CAST(my_binary_30 AS DECIMAL(37,2)), my_binary_30, id FROM t1_values WHERE select_id = 60 OR select_id IS NULL; -CAST(my_binary_30 AS DECIMAL) my_binary_30 id +CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 @@ -3356,11 +3270,11 @@ Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal) AS `CAST(my_binary_30 AS DECIMAL)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 60 OR select_id IS NULL); -CAST(my_binary_30 AS DECIMAL) my_binary_30 id +CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 @@ -3379,12 +3293,12 @@ Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)), my_varchar_1000, id FROM t1_values; -SELECT CAST(my_varchar_1000 AS DECIMAL), +SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)), my_varchar_1000, id FROM t1_values WHERE select_id = 59 OR select_id IS NULL; -CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id +CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 @@ -3397,11 +3311,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal) AS `CAST(my_varchar_1000 AS DECIMAL)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 59 OR select_id IS NULL); -CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id +CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 @@ -3415,12 +3329,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL(37,2)), my_char_30, id FROM t1_values; -SELECT CAST(my_char_30 AS DECIMAL), +SELECT CAST(my_char_30 AS DECIMAL(37,2)), my_char_30, id FROM t1_values WHERE select_id = 58 OR select_id IS NULL; -CAST(my_char_30 AS DECIMAL) my_char_30 id +CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 @@ -3436,11 +3350,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal) AS `CAST(my_char_30 AS DECIMAL)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 58 OR select_id IS NULL); -CAST(my_char_30 AS DECIMAL) my_char_30 id +CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_0102.result b/mysql-test/suite/funcs_1/r/innodb_trig_0102.result index a2bb203b294..56f20781995 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_0102.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_0102.result @@ -237,7 +237,7 @@ create table t1 (f1 integer) engine = innodb; use test; CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 for each row set @ret_trg6_2 = 5; -ERROR HY000: Trigger in wrong schema +ERROR 42S02: Table 'trig_db.tb3' doesn't exist use trig_db; CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 for each row set @ret_trg6_3 = 18; diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_08.result b/mysql-test/suite/funcs_1/r/innodb_trig_08.result index 0f2d54f01ba..bb087d5882e 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_08.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_08.result @@ -484,9 +484,8 @@ BEGIN WHILE @counter1 < new.f136 SET @counter1 = @counter1 + 1; END// -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHILE @counter1 < new.f136 -SET @counter1 = @counter1 + 1; -END' at line 3 +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET @counter1 = @counter1 + 1; +END' at line 4 delete from tb3 where f122='Test 3.5.8.5-while'; drop trigger trg7; diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_09.result b/mysql-test/suite/funcs_1/r/innodb_trig_09.result index 54b191e401e..685de95db51 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_09.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_09.result @@ -194,7 +194,7 @@ a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000 Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL where f122='Test 3.5.9.4'; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'f136' at row 11 +Warning 1048 Column 'f136' cannot be null select f118, f121, f122, f136, f151, f163 from tb3 where f122 like 'Test 3.5.9.4-trig'; f118 f121 f122 f136 f151 f163 diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result index 63d1c8a3131..3bb56a82612 100644 --- a/mysql-test/suite/funcs_1/r/innodb_views.result +++ b/mysql-test/suite/funcs_1/r/innodb_views.result @@ -10202,7 +10202,8 @@ SHOW FIELDS FROM v1; ERROR 42S02: Table 'test.v1' doesn't exist CHECK TABLE v1; Table Op Msg_type Msg_text -test.v1 check error Table 'test.v1' doesn't exist +test.v1 check Error Table 'test.v1' doesn't exist +test.v1 check error Corrupt DESCRIBE v1; ERROR 42S02: Table 'test.v1' doesn't exist EXPLAIN SELECT * FROM v1; diff --git a/mysql-test/suite/funcs_1/r/memory__datadict.result b/mysql-test/suite/funcs_1/r/memory__datadict.result index 1dea8a5f4a9..fda7cc6e76e 100644 --- a/mysql-test/suite/funcs_1/r/memory__datadict.result +++ b/mysql-test/suite/funcs_1/r/memory__datadict.result @@ -4842,6 +4842,7 @@ INTO OUTFILE '../tmp/out.memory.db.file' WHERE schema_name LIKE 'db_%'; CREATE USER user_3212@localhost; GRANT ALL ON db_datadict.* TO user_3212@localhost; +GRANT FILE ON *.* TO user_3212@localhost; connect(localhost,user_3212,,db_datadict,MYSQL_PORT,MYSQL_SOCK); user_3212@localhost db_datadict @@ -4850,7 +4851,7 @@ INTO OUTFILE '../tmp/out.memory.user.file' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM schemata LIMIT 0, 5; -ERROR 28000: Access denied for user 'user_3212'@'localhost' (using password: NO) +ERROR 42S02: Table 'db_datadict.schemata' doesn't exist SELECT * FROM schemata LIMIT 0, 5; ERROR 42S02: Table 'db_datadict.schemata' doesn't exist diff --git a/mysql-test/suite/funcs_1/r/memory_func_view.result b/mysql-test/suite/funcs_1/r/memory_func_view.result index 08e49d1bf6f..552b549a1a0 100644 --- a/mysql-test/suite/funcs_1/r/memory_func_view.result +++ b/mysql-test/suite/funcs_1/r/memory_func_view.result @@ -2400,16 +2400,10 @@ my_time, id FROM t1_values WHERE select_id = 89 OR select_id IS NULL; CAST(my_time AS UNSIGNED INTEGER) my_time id NULL NULL 1 -18446744073709550778 -838:59:59 2 -838 838:59:59 3 -13 13:00:00 4 -10 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '-838:59:59' -Warning 1105 Cast to unsigned converted negative integer to it's positive complement -Warning 1292 Truncated incorrect INTEGER value: '838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '13:00:00' -Warning 1292 Truncated incorrect INTEGER value: '10:00:00' +18446744073701165657 -838:59:59 2 +8385959 838:59:59 3 +130000 13:00:00 4 +100000 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as unsigned) AS `CAST(my_time AS UNSIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` @@ -2418,16 +2412,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 89 OR select_id IS NULL); CAST(my_time AS UNSIGNED INTEGER) my_time id NULL NULL 1 -18446744073709550778 -838:59:59 2 -838 838:59:59 3 -13 13:00:00 4 -10 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '-838:59:59' -Warning 1105 Cast to unsigned converted negative integer to it's positive complement -Warning 1292 Truncated incorrect INTEGER value: '838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '13:00:00' -Warning 1292 Truncated incorrect INTEGER value: '10:00:00' +18446744073701165657 -838:59:59 2 +8385959 838:59:59 3 +130000 13:00:00 4 +100000 10:00:00 5 DROP VIEW v1; @@ -2438,16 +2426,10 @@ my_timestamp, id FROM t1_values WHERE select_id = 88 OR select_id IS NULL; CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 -1970 1970-01-01 03:00:01 2 -2038 2038-01-01 02:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01' -Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +19700101030001 1970-01-01 03:00:01 2 +20380101025959 2038-01-01 02:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as unsigned) AS `CAST(my_timestamp AS UNSIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` @@ -2456,16 +2438,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 88 OR select_id IS NULL); CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 -1970 1970-01-01 03:00:01 2 -2038 2038-01-01 02:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01' -Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +19700101030001 1970-01-01 03:00:01 2 +20380101025959 2038-01-01 02:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 DROP VIEW v1; @@ -2476,15 +2452,10 @@ my_date, id FROM t1_values WHERE select_id = 87 OR select_id IS NULL; CAST(my_date AS UNSIGNED INTEGER) my_date id NULL NULL 1 -1 0001-01-01 2 -9999 9999-12-31 3 -2004 2004-02-29 4 -2005 2005-06-28 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28' +10101 0001-01-01 2 +99991231 9999-12-31 3 +20040229 2004-02-29 4 +20050628 2005-06-28 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as unsigned) AS `CAST(my_date AS UNSIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` @@ -2493,15 +2464,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 87 OR select_id IS NULL); CAST(my_date AS UNSIGNED INTEGER) my_date id NULL NULL 1 -1 0001-01-01 2 -9999 9999-12-31 3 -2004 2004-02-29 4 -2005 2005-06-28 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28' +10101 0001-01-01 2 +99991231 9999-12-31 3 +20040229 2004-02-29 4 +20050628 2005-06-28 5 DROP VIEW v1; @@ -2512,15 +2478,10 @@ my_datetime, id FROM t1_values WHERE select_id = 86 OR select_id IS NULL; CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id NULL NULL 1 -1 0001-01-01 00:00:00 2 -9999 9999-12-31 23:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +10101000000 0001-01-01 00:00:00 2 +99991231235959 9999-12-31 23:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as unsigned) AS `CAST(my_datetime AS UNSIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` @@ -2529,15 +2490,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 86 OR select_id IS NULL); CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id NULL NULL 1 -1 0001-01-01 00:00:00 2 -9999 9999-12-31 23:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +10101000000 0001-01-01 00:00:00 2 +99991231235959 9999-12-31 23:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 DROP VIEW v1; @@ -2780,15 +2736,10 @@ my_time, id FROM t1_values WHERE select_id = 78 OR select_id IS NULL; CAST(my_time AS SIGNED INTEGER) my_time id NULL NULL 1 --838 -838:59:59 2 -838 838:59:59 3 -13 13:00:00 4 -10 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '-838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '13:00:00' -Warning 1292 Truncated incorrect INTEGER value: '10:00:00' +-8385959 -838:59:59 2 +8385959 838:59:59 3 +130000 13:00:00 4 +100000 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as signed) AS `CAST(my_time AS SIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` @@ -2797,15 +2748,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 78 OR select_id IS NULL); CAST(my_time AS SIGNED INTEGER) my_time id NULL NULL 1 --838 -838:59:59 2 -838 838:59:59 3 -13 13:00:00 4 -10 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '-838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '13:00:00' -Warning 1292 Truncated incorrect INTEGER value: '10:00:00' +-8385959 -838:59:59 2 +8385959 838:59:59 3 +130000 13:00:00 4 +100000 10:00:00 5 DROP VIEW v1; @@ -2816,16 +2762,10 @@ my_timestamp, id FROM t1_values WHERE select_id = 77 OR select_id IS NULL; CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 -1970 1970-01-01 03:00:01 2 -2038 2038-01-01 02:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01' -Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +19700101030001 1970-01-01 03:00:01 2 +20380101025959 2038-01-01 02:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as signed) AS `CAST(my_timestamp AS SIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` @@ -2834,16 +2774,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 77 OR select_id IS NULL); CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 -1970 1970-01-01 03:00:01 2 -2038 2038-01-01 02:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01' -Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +19700101030001 1970-01-01 03:00:01 2 +20380101025959 2038-01-01 02:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 DROP VIEW v1; @@ -2854,15 +2788,10 @@ my_date, id FROM t1_values WHERE select_id = 76 OR select_id IS NULL; CAST(my_date AS SIGNED INTEGER) my_date id NULL NULL 1 -1 0001-01-01 2 -9999 9999-12-31 3 -2004 2004-02-29 4 -2005 2005-06-28 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28' +10101 0001-01-01 2 +99991231 9999-12-31 3 +20040229 2004-02-29 4 +20050628 2005-06-28 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as signed) AS `CAST(my_date AS SIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` @@ -2871,15 +2800,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 76 OR select_id IS NULL); CAST(my_date AS SIGNED INTEGER) my_date id NULL NULL 1 -1 0001-01-01 2 -9999 9999-12-31 3 -2004 2004-02-29 4 -2005 2005-06-28 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28' +10101 0001-01-01 2 +99991231 9999-12-31 3 +20040229 2004-02-29 4 +20050628 2005-06-28 5 DROP VIEW v1; @@ -2890,15 +2814,10 @@ my_datetime, id FROM t1_values WHERE select_id = 75 OR select_id IS NULL; CAST(my_datetime AS SIGNED INTEGER) my_datetime id NULL NULL 1 -1 0001-01-01 00:00:00 2 -9999 9999-12-31 23:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +10101000000 0001-01-01 00:00:00 2 +99991231235959 9999-12-31 23:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as signed) AS `CAST(my_datetime AS SIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` @@ -2907,15 +2826,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 75 OR select_id IS NULL); CAST(my_datetime AS SIGNED INTEGER) my_datetime id NULL NULL 1 -1 0001-01-01 00:00:00 2 -9999 9999-12-31 23:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +10101000000 0001-01-01 00:00:00 2 +99991231235959 9999-12-31 23:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 DROP VIEW v1; @@ -2926,8 +2840,8 @@ my_decimal, id FROM t1_values WHERE select_id = 74 OR select_id IS NULL; CAST(my_decimal AS SIGNED INTEGER) my_decimal id NULL NULL 1 --10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2 -10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3 +-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2 +9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3 0 0.000000000000000000000000000000 4 -1 -1.000000000000000000000000000000 5 Warnings: @@ -2941,8 +2855,8 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 74 OR select_id IS NULL); CAST(my_decimal AS SIGNED INTEGER) my_decimal id NULL NULL 1 --10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2 -10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3 +-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2 +9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3 0 0.000000000000000000000000000000 4 -1 -1.000000000000000000000000000000 5 Warnings: @@ -3115,12 +3029,12 @@ Warning 1292 Truncated incorrect INTEGER value: ' --- DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL(37,2)), my_year, id FROM t1_values; -SELECT CAST(my_year AS DECIMAL), +SELECT CAST(my_year AS DECIMAL(37,2)), my_year, id FROM t1_values WHERE select_id = 68 OR select_id IS NULL; -CAST(my_year AS DECIMAL) my_year id +CAST(my_year AS DECIMAL(37,2)) my_year id NULL NULL 1 1901.00 1901 2 2155.00 2155 3 @@ -3128,11 +3042,11 @@ NULL NULL 1 2005.00 2005 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal) AS `CAST(my_year AS DECIMAL)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal(37,2)) AS `CAST(my_year AS DECIMAL(37,2))`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 68 OR select_id IS NULL); -CAST(my_year AS DECIMAL) my_year id +CAST(my_year AS DECIMAL(37,2)) my_year id NULL NULL 1 1901.00 1901 2 2155.00 2155 3 @@ -3141,12 +3055,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL(37,2)), my_time, id FROM t1_values; -SELECT CAST(my_time AS DECIMAL), +SELECT CAST(my_time AS DECIMAL(37,2)), my_time, id FROM t1_values WHERE select_id = 67 OR select_id IS NULL; -CAST(my_time AS DECIMAL) my_time id +CAST(my_time AS DECIMAL(37,2)) my_time id NULL NULL 1 -8385959.00 -838:59:59 2 8385959.00 838:59:59 3 @@ -3154,11 +3068,11 @@ NULL NULL 1 100000.00 10:00:00 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal) AS `CAST(my_time AS DECIMAL)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal(37,2)) AS `CAST(my_time AS DECIMAL(37,2))`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 67 OR select_id IS NULL); -CAST(my_time AS DECIMAL) my_time id +CAST(my_time AS DECIMAL(37,2)) my_time id NULL NULL 1 -8385959.00 -838:59:59 2 8385959.00 838:59:59 3 @@ -3167,12 +3081,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL(37,2)), my_timestamp, id FROM t1_values; -SELECT CAST(my_timestamp AS DECIMAL), +SELECT CAST(my_timestamp AS DECIMAL(37,2)), my_timestamp, id FROM t1_values WHERE select_id = 66 OR select_id IS NULL; -CAST(my_timestamp AS DECIMAL) my_timestamp id +CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id 0.00 0000-00-00 00:00:00 1 19700101030001.00 1970-01-01 03:00:01 2 20380101025959.00 2038-01-01 02:59:59 3 @@ -3180,11 +3094,11 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id 20050628100000.00 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal) AS `CAST(my_timestamp AS DECIMAL)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal(37,2)) AS `CAST(my_timestamp AS DECIMAL(37,2))`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 66 OR select_id IS NULL); -CAST(my_timestamp AS DECIMAL) my_timestamp id +CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id 0.00 0000-00-00 00:00:00 1 19700101030001.00 1970-01-01 03:00:01 2 20380101025959.00 2038-01-01 02:59:59 3 @@ -3193,12 +3107,12 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL(37,2)), my_date, id FROM t1_values; -SELECT CAST(my_date AS DECIMAL), +SELECT CAST(my_date AS DECIMAL(37,2)), my_date, id FROM t1_values WHERE select_id = 65 OR select_id IS NULL; -CAST(my_date AS DECIMAL) my_date id +CAST(my_date AS DECIMAL(37,2)) my_date id NULL NULL 1 10101.00 0001-01-01 2 99991231.00 9999-12-31 3 @@ -3206,11 +3120,11 @@ NULL NULL 1 20050628.00 2005-06-28 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal) AS `CAST(my_date AS DECIMAL)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal(37,2)) AS `CAST(my_date AS DECIMAL(37,2))`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 65 OR select_id IS NULL); -CAST(my_date AS DECIMAL) my_date id +CAST(my_date AS DECIMAL(37,2)) my_date id NULL NULL 1 10101.00 0001-01-01 2 99991231.00 9999-12-31 3 @@ -3219,12 +3133,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL(37,2)), my_datetime, id FROM t1_values; -SELECT CAST(my_datetime AS DECIMAL), +SELECT CAST(my_datetime AS DECIMAL(37,2)), my_datetime, id FROM t1_values WHERE select_id = 64 OR select_id IS NULL; -CAST(my_datetime AS DECIMAL) my_datetime id +CAST(my_datetime AS DECIMAL(37,2)) my_datetime id NULL NULL 1 10101000000.00 0001-01-01 00:00:00 2 99991231235959.00 9999-12-31 23:59:59 3 @@ -3232,11 +3146,11 @@ NULL NULL 1 20050628100000.00 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal) AS `CAST(my_datetime AS DECIMAL)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal(37,2)) AS `CAST(my_datetime AS DECIMAL(37,2))`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 64 OR select_id IS NULL); -CAST(my_datetime AS DECIMAL) my_datetime id +CAST(my_datetime AS DECIMAL(37,2)) my_datetime id NULL NULL 1 10101000000.00 0001-01-01 00:00:00 2 99991231235959.00 9999-12-31 23:59:59 3 @@ -3245,12 +3159,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL(37,2)), my_decimal, id FROM t1_values; -SELECT CAST(my_decimal AS DECIMAL), +SELECT CAST(my_decimal AS DECIMAL(37,2)), my_decimal, id FROM t1_values WHERE select_id = 63 OR select_id IS NULL; -CAST(my_decimal AS DECIMAL) my_decimal id +CAST(my_decimal AS DECIMAL(37,2)) my_decimal id NULL NULL 1 -10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2 10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3 @@ -3258,11 +3172,11 @@ NULL NULL 1 -1.00 -1.000000000000000000000000000000 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal) AS `CAST(my_decimal AS DECIMAL)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal(37,2)) AS `CAST(my_decimal AS DECIMAL(37,2))`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 63 OR select_id IS NULL); -CAST(my_decimal AS DECIMAL) my_decimal id +CAST(my_decimal AS DECIMAL(37,2)) my_decimal id NULL NULL 1 -10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2 10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3 @@ -3271,12 +3185,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL(37,2)), my_bigint, id FROM t1_values; -SELECT CAST(my_bigint AS DECIMAL), +SELECT CAST(my_bigint AS DECIMAL(37,2)), my_bigint, id FROM t1_values WHERE select_id = 62 OR select_id IS NULL; -CAST(my_bigint AS DECIMAL) my_bigint id +CAST(my_bigint AS DECIMAL(37,2)) my_bigint id NULL NULL 1 -9223372036854775808.00 -9223372036854775808 2 9223372036854775807.00 9223372036854775807 3 @@ -3284,11 +3198,11 @@ NULL NULL 1 -1.00 -1 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal) AS `CAST(my_bigint AS DECIMAL)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal(37,2)) AS `CAST(my_bigint AS DECIMAL(37,2))`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 62 OR select_id IS NULL); -CAST(my_bigint AS DECIMAL) my_bigint id +CAST(my_bigint AS DECIMAL(37,2)) my_bigint id NULL NULL 1 -9223372036854775808.00 -9223372036854775808 2 9223372036854775807.00 9223372036854775807 3 @@ -3297,12 +3211,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)), my_varbinary_1000, id FROM t1_values; -SELECT CAST(my_varbinary_1000 AS DECIMAL), +SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)), my_varbinary_1000, id FROM t1_values WHERE select_id = 61 OR select_id IS NULL; -CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id +CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 @@ -3315,11 +3229,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal) AS `CAST(my_varbinary_1000 AS DECIMAL)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 61 OR select_id IS NULL); -CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id +CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 @@ -3333,12 +3247,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL(37,2)), my_binary_30, id FROM t1_values; -SELECT CAST(my_binary_30 AS DECIMAL), +SELECT CAST(my_binary_30 AS DECIMAL(37,2)), my_binary_30, id FROM t1_values WHERE select_id = 60 OR select_id IS NULL; -CAST(my_binary_30 AS DECIMAL) my_binary_30 id +CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 @@ -3356,11 +3270,11 @@ Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal) AS `CAST(my_binary_30 AS DECIMAL)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 60 OR select_id IS NULL); -CAST(my_binary_30 AS DECIMAL) my_binary_30 id +CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 @@ -3379,12 +3293,12 @@ Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)), my_varchar_1000, id FROM t1_values; -SELECT CAST(my_varchar_1000 AS DECIMAL), +SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)), my_varchar_1000, id FROM t1_values WHERE select_id = 59 OR select_id IS NULL; -CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id +CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 @@ -3397,11 +3311,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal) AS `CAST(my_varchar_1000 AS DECIMAL)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 59 OR select_id IS NULL); -CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id +CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 @@ -3415,12 +3329,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL(37,2)), my_char_30, id FROM t1_values; -SELECT CAST(my_char_30 AS DECIMAL), +SELECT CAST(my_char_30 AS DECIMAL(37,2)), my_char_30, id FROM t1_values WHERE select_id = 58 OR select_id IS NULL; -CAST(my_char_30 AS DECIMAL) my_char_30 id +CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 @@ -3436,11 +3350,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal) AS `CAST(my_char_30 AS DECIMAL)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 58 OR select_id IS NULL); -CAST(my_char_30 AS DECIMAL) my_char_30 id +CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 diff --git a/mysql-test/suite/funcs_1/r/memory_trig_0102.result b/mysql-test/suite/funcs_1/r/memory_trig_0102.result index 0a640201d76..e7fec297ca7 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_0102.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_0102.result @@ -233,7 +233,7 @@ create table t1 (f1 integer) engine = memory; use test; CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 for each row set @ret_trg6_2 = 5; -ERROR HY000: Trigger in wrong schema +ERROR 42S02: Table 'trig_db.tb3' doesn't exist use trig_db; CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 for each row set @ret_trg6_3 = 18; diff --git a/mysql-test/suite/funcs_1/r/memory_trig_08.result b/mysql-test/suite/funcs_1/r/memory_trig_08.result index 9a14845d0eb..a842bbc3ac7 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_08.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_08.result @@ -480,9 +480,8 @@ BEGIN WHILE @counter1 < new.f136 SET @counter1 = @counter1 + 1; END// -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHILE @counter1 < new.f136 -SET @counter1 = @counter1 + 1; -END' at line 3 +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET @counter1 = @counter1 + 1; +END' at line 4 delete from tb3 where f122='Test 3.5.8.5-while'; drop trigger trg7; diff --git a/mysql-test/suite/funcs_1/r/memory_trig_09.result b/mysql-test/suite/funcs_1/r/memory_trig_09.result index c1b9ec6d33f..3dbe64958e3 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_09.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_09.result @@ -190,7 +190,7 @@ a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000 Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL where f122='Test 3.5.9.4'; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'f136' at row 11 +Warning 1048 Column 'f136' cannot be null select f118, f121, f122, f136, f151, f163 from tb3 where f122 like 'Test 3.5.9.4-trig'; f118 f121 f122 f136 f151 f163 diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result index 516eef24439..69dee081446 100644 --- a/mysql-test/suite/funcs_1/r/memory_views.result +++ b/mysql-test/suite/funcs_1/r/memory_views.result @@ -10207,7 +10207,8 @@ SHOW FIELDS FROM v1; ERROR 42S02: Table 'test.v1' doesn't exist CHECK TABLE v1; Table Op Msg_type Msg_text -test.v1 check error Table 'test.v1' doesn't exist +test.v1 check Error Table 'test.v1' doesn't exist +test.v1 check error Corrupt DESCRIBE v1; ERROR 42S02: Table 'test.v1' doesn't exist EXPLAIN SELECT * FROM v1; diff --git a/mysql-test/suite/funcs_1/r/myisam__datadict.result b/mysql-test/suite/funcs_1/r/myisam__datadict.result index e9082e7aee7..b95d51f3801 100644 --- a/mysql-test/suite/funcs_1/r/myisam__datadict.result +++ b/mysql-test/suite/funcs_1/r/myisam__datadict.result @@ -4912,6 +4912,7 @@ INTO OUTFILE '../tmp/out.myisam.db.file' WHERE schema_name LIKE 'db_%'; CREATE USER user_3212@localhost; GRANT ALL ON db_datadict.* TO user_3212@localhost; +GRANT FILE ON *.* TO user_3212@localhost; connect(localhost,user_3212,,db_datadict,MYSQL_PORT,MYSQL_SOCK); user_3212@localhost db_datadict @@ -4920,7 +4921,7 @@ INTO OUTFILE '../tmp/out.myisam.user.file' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM schemata LIMIT 0, 5; -ERROR 28000: Access denied for user 'user_3212'@'localhost' (using password: NO) +ERROR 42S02: Table 'db_datadict.schemata' doesn't exist SELECT * FROM schemata LIMIT 0, 5; ERROR 42S02: Table 'db_datadict.schemata' doesn't exist diff --git a/mysql-test/suite/funcs_1/r/myisam_func_view.result b/mysql-test/suite/funcs_1/r/myisam_func_view.result index 4f8a1b23bc0..94cba9796a2 100644 --- a/mysql-test/suite/funcs_1/r/myisam_func_view.result +++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result @@ -2400,16 +2400,10 @@ my_time, id FROM t1_values WHERE select_id = 89 OR select_id IS NULL; CAST(my_time AS UNSIGNED INTEGER) my_time id NULL NULL 1 -18446744073709550778 -838:59:59 2 -838 838:59:59 3 -13 13:00:00 4 -10 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '-838:59:59' -Warning 1105 Cast to unsigned converted negative integer to it's positive complement -Warning 1292 Truncated incorrect INTEGER value: '838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '13:00:00' -Warning 1292 Truncated incorrect INTEGER value: '10:00:00' +18446744073701165657 -838:59:59 2 +8385959 838:59:59 3 +130000 13:00:00 4 +100000 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as unsigned) AS `CAST(my_time AS UNSIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` @@ -2418,16 +2412,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 89 OR select_id IS NULL); CAST(my_time AS UNSIGNED INTEGER) my_time id NULL NULL 1 -18446744073709550778 -838:59:59 2 -838 838:59:59 3 -13 13:00:00 4 -10 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '-838:59:59' -Warning 1105 Cast to unsigned converted negative integer to it's positive complement -Warning 1292 Truncated incorrect INTEGER value: '838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '13:00:00' -Warning 1292 Truncated incorrect INTEGER value: '10:00:00' +18446744073701165657 -838:59:59 2 +8385959 838:59:59 3 +130000 13:00:00 4 +100000 10:00:00 5 DROP VIEW v1; @@ -2438,16 +2426,10 @@ my_timestamp, id FROM t1_values WHERE select_id = 88 OR select_id IS NULL; CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 -1970 1970-01-01 03:00:01 2 -2038 2038-01-01 02:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01' -Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +19700101030001 1970-01-01 03:00:01 2 +20380101025959 2038-01-01 02:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as unsigned) AS `CAST(my_timestamp AS UNSIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` @@ -2456,16 +2438,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 88 OR select_id IS NULL); CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 -1970 1970-01-01 03:00:01 2 -2038 2038-01-01 02:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01' -Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +19700101030001 1970-01-01 03:00:01 2 +20380101025959 2038-01-01 02:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 DROP VIEW v1; @@ -2476,15 +2452,10 @@ my_date, id FROM t1_values WHERE select_id = 87 OR select_id IS NULL; CAST(my_date AS UNSIGNED INTEGER) my_date id NULL NULL 1 -1 0001-01-01 2 -9999 9999-12-31 3 -2004 2004-02-29 4 -2005 2005-06-28 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28' +10101 0001-01-01 2 +99991231 9999-12-31 3 +20040229 2004-02-29 4 +20050628 2005-06-28 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as unsigned) AS `CAST(my_date AS UNSIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` @@ -2493,15 +2464,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 87 OR select_id IS NULL); CAST(my_date AS UNSIGNED INTEGER) my_date id NULL NULL 1 -1 0001-01-01 2 -9999 9999-12-31 3 -2004 2004-02-29 4 -2005 2005-06-28 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28' +10101 0001-01-01 2 +99991231 9999-12-31 3 +20040229 2004-02-29 4 +20050628 2005-06-28 5 DROP VIEW v1; @@ -2512,15 +2478,10 @@ my_datetime, id FROM t1_values WHERE select_id = 86 OR select_id IS NULL; CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id NULL NULL 1 -1 0001-01-01 00:00:00 2 -9999 9999-12-31 23:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +10101000000 0001-01-01 00:00:00 2 +99991231235959 9999-12-31 23:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as unsigned) AS `CAST(my_datetime AS UNSIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` @@ -2529,15 +2490,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 86 OR select_id IS NULL); CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id NULL NULL 1 -1 0001-01-01 00:00:00 2 -9999 9999-12-31 23:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +10101000000 0001-01-01 00:00:00 2 +99991231235959 9999-12-31 23:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 DROP VIEW v1; @@ -2780,15 +2736,10 @@ my_time, id FROM t1_values WHERE select_id = 78 OR select_id IS NULL; CAST(my_time AS SIGNED INTEGER) my_time id NULL NULL 1 --838 -838:59:59 2 -838 838:59:59 3 -13 13:00:00 4 -10 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '-838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '13:00:00' -Warning 1292 Truncated incorrect INTEGER value: '10:00:00' +-8385959 -838:59:59 2 +8385959 838:59:59 3 +130000 13:00:00 4 +100000 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as signed) AS `CAST(my_time AS SIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` @@ -2797,15 +2748,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 78 OR select_id IS NULL); CAST(my_time AS SIGNED INTEGER) my_time id NULL NULL 1 --838 -838:59:59 2 -838 838:59:59 3 -13 13:00:00 4 -10 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '-838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '838:59:59' -Warning 1292 Truncated incorrect INTEGER value: '13:00:00' -Warning 1292 Truncated incorrect INTEGER value: '10:00:00' +-8385959 -838:59:59 2 +8385959 838:59:59 3 +130000 13:00:00 4 +100000 10:00:00 5 DROP VIEW v1; @@ -2816,16 +2762,10 @@ my_timestamp, id FROM t1_values WHERE select_id = 77 OR select_id IS NULL; CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 -1970 1970-01-01 03:00:01 2 -2038 2038-01-01 02:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01' -Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +19700101030001 1970-01-01 03:00:01 2 +20380101025959 2038-01-01 02:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as signed) AS `CAST(my_timestamp AS SIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` @@ -2834,16 +2774,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 77 OR select_id IS NULL); CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id 0 0000-00-00 00:00:00 1 -1970 1970-01-01 03:00:01 2 -2038 2038-01-01 02:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01' -Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +19700101030001 1970-01-01 03:00:01 2 +20380101025959 2038-01-01 02:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 DROP VIEW v1; @@ -2854,15 +2788,10 @@ my_date, id FROM t1_values WHERE select_id = 76 OR select_id IS NULL; CAST(my_date AS SIGNED INTEGER) my_date id NULL NULL 1 -1 0001-01-01 2 -9999 9999-12-31 3 -2004 2004-02-29 4 -2005 2005-06-28 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28' +10101 0001-01-01 2 +99991231 9999-12-31 3 +20040229 2004-02-29 4 +20050628 2005-06-28 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as signed) AS `CAST(my_date AS SIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` @@ -2871,15 +2800,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 76 OR select_id IS NULL); CAST(my_date AS SIGNED INTEGER) my_date id NULL NULL 1 -1 0001-01-01 2 -9999 9999-12-31 3 -2004 2004-02-29 4 -2005 2005-06-28 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28' +10101 0001-01-01 2 +99991231 9999-12-31 3 +20040229 2004-02-29 4 +20050628 2005-06-28 5 DROP VIEW v1; @@ -2890,15 +2814,10 @@ my_datetime, id FROM t1_values WHERE select_id = 75 OR select_id IS NULL; CAST(my_datetime AS SIGNED INTEGER) my_datetime id NULL NULL 1 -1 0001-01-01 00:00:00 2 -9999 9999-12-31 23:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +10101000000 0001-01-01 00:00:00 2 +99991231235959 9999-12-31 23:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as signed) AS `CAST(my_datetime AS SIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` @@ -2907,15 +2826,10 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 75 OR select_id IS NULL); CAST(my_datetime AS SIGNED INTEGER) my_datetime id NULL NULL 1 -1 0001-01-01 00:00:00 2 -9999 9999-12-31 23:59:59 3 -2004 2004-02-29 23:59:59 4 -2005 2005-06-28 10:00:00 5 -Warnings: -Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00' -Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59' -Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00' +10101000000 0001-01-01 00:00:00 2 +99991231235959 9999-12-31 23:59:59 3 +20040229235959 2004-02-29 23:59:59 4 +20050628100000 2005-06-28 10:00:00 5 DROP VIEW v1; @@ -2926,8 +2840,8 @@ my_decimal, id FROM t1_values WHERE select_id = 74 OR select_id IS NULL; CAST(my_decimal AS SIGNED INTEGER) my_decimal id NULL NULL 1 --10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2 -10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3 +-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2 +9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3 0 0.000000000000000000000000000000 4 -1 -1.000000000000000000000000000000 5 Warnings: @@ -2941,8 +2855,8 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 74 OR select_id IS NULL); CAST(my_decimal AS SIGNED INTEGER) my_decimal id NULL NULL 1 --10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2 -10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3 +-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2 +9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3 0 0.000000000000000000000000000000 4 -1 -1.000000000000000000000000000000 5 Warnings: @@ -3115,12 +3029,12 @@ Warning 1292 Truncated incorrect INTEGER value: ' --- DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL(37,2)), my_year, id FROM t1_values; -SELECT CAST(my_year AS DECIMAL), +SELECT CAST(my_year AS DECIMAL(37,2)), my_year, id FROM t1_values WHERE select_id = 68 OR select_id IS NULL; -CAST(my_year AS DECIMAL) my_year id +CAST(my_year AS DECIMAL(37,2)) my_year id NULL NULL 1 1901.00 1901 2 2155.00 2155 3 @@ -3128,11 +3042,11 @@ NULL NULL 1 2005.00 2005 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal) AS `CAST(my_year AS DECIMAL)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal(37,2)) AS `CAST(my_year AS DECIMAL(37,2))`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 68 OR select_id IS NULL); -CAST(my_year AS DECIMAL) my_year id +CAST(my_year AS DECIMAL(37,2)) my_year id NULL NULL 1 1901.00 1901 2 2155.00 2155 3 @@ -3141,12 +3055,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL(37,2)), my_time, id FROM t1_values; -SELECT CAST(my_time AS DECIMAL), +SELECT CAST(my_time AS DECIMAL(37,2)), my_time, id FROM t1_values WHERE select_id = 67 OR select_id IS NULL; -CAST(my_time AS DECIMAL) my_time id +CAST(my_time AS DECIMAL(37,2)) my_time id NULL NULL 1 -8385959.00 -838:59:59 2 8385959.00 838:59:59 3 @@ -3154,11 +3068,11 @@ NULL NULL 1 100000.00 10:00:00 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal) AS `CAST(my_time AS DECIMAL)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal(37,2)) AS `CAST(my_time AS DECIMAL(37,2))`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 67 OR select_id IS NULL); -CAST(my_time AS DECIMAL) my_time id +CAST(my_time AS DECIMAL(37,2)) my_time id NULL NULL 1 -8385959.00 -838:59:59 2 8385959.00 838:59:59 3 @@ -3167,12 +3081,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL(37,2)), my_timestamp, id FROM t1_values; -SELECT CAST(my_timestamp AS DECIMAL), +SELECT CAST(my_timestamp AS DECIMAL(37,2)), my_timestamp, id FROM t1_values WHERE select_id = 66 OR select_id IS NULL; -CAST(my_timestamp AS DECIMAL) my_timestamp id +CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id 0.00 0000-00-00 00:00:00 1 19700101030001.00 1970-01-01 03:00:01 2 20380101025959.00 2038-01-01 02:59:59 3 @@ -3180,11 +3094,11 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id 20050628100000.00 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal) AS `CAST(my_timestamp AS DECIMAL)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal(37,2)) AS `CAST(my_timestamp AS DECIMAL(37,2))`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 66 OR select_id IS NULL); -CAST(my_timestamp AS DECIMAL) my_timestamp id +CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id 0.00 0000-00-00 00:00:00 1 19700101030001.00 1970-01-01 03:00:01 2 20380101025959.00 2038-01-01 02:59:59 3 @@ -3193,12 +3107,12 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL(37,2)), my_date, id FROM t1_values; -SELECT CAST(my_date AS DECIMAL), +SELECT CAST(my_date AS DECIMAL(37,2)), my_date, id FROM t1_values WHERE select_id = 65 OR select_id IS NULL; -CAST(my_date AS DECIMAL) my_date id +CAST(my_date AS DECIMAL(37,2)) my_date id NULL NULL 1 10101.00 0001-01-01 2 99991231.00 9999-12-31 3 @@ -3206,11 +3120,11 @@ NULL NULL 1 20050628.00 2005-06-28 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal) AS `CAST(my_date AS DECIMAL)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal(37,2)) AS `CAST(my_date AS DECIMAL(37,2))`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 65 OR select_id IS NULL); -CAST(my_date AS DECIMAL) my_date id +CAST(my_date AS DECIMAL(37,2)) my_date id NULL NULL 1 10101.00 0001-01-01 2 99991231.00 9999-12-31 3 @@ -3219,12 +3133,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL(37,2)), my_datetime, id FROM t1_values; -SELECT CAST(my_datetime AS DECIMAL), +SELECT CAST(my_datetime AS DECIMAL(37,2)), my_datetime, id FROM t1_values WHERE select_id = 64 OR select_id IS NULL; -CAST(my_datetime AS DECIMAL) my_datetime id +CAST(my_datetime AS DECIMAL(37,2)) my_datetime id NULL NULL 1 10101000000.00 0001-01-01 00:00:00 2 99991231235959.00 9999-12-31 23:59:59 3 @@ -3232,11 +3146,11 @@ NULL NULL 1 20050628100000.00 2005-06-28 10:00:00 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal) AS `CAST(my_datetime AS DECIMAL)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal(37,2)) AS `CAST(my_datetime AS DECIMAL(37,2))`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 64 OR select_id IS NULL); -CAST(my_datetime AS DECIMAL) my_datetime id +CAST(my_datetime AS DECIMAL(37,2)) my_datetime id NULL NULL 1 10101000000.00 0001-01-01 00:00:00 2 99991231235959.00 9999-12-31 23:59:59 3 @@ -3245,12 +3159,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL(37,2)), my_decimal, id FROM t1_values; -SELECT CAST(my_decimal AS DECIMAL), +SELECT CAST(my_decimal AS DECIMAL(37,2)), my_decimal, id FROM t1_values WHERE select_id = 63 OR select_id IS NULL; -CAST(my_decimal AS DECIMAL) my_decimal id +CAST(my_decimal AS DECIMAL(37,2)) my_decimal id NULL NULL 1 -10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2 10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3 @@ -3258,11 +3172,11 @@ NULL NULL 1 -1.00 -1.000000000000000000000000000000 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal) AS `CAST(my_decimal AS DECIMAL)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal(37,2)) AS `CAST(my_decimal AS DECIMAL(37,2))`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 63 OR select_id IS NULL); -CAST(my_decimal AS DECIMAL) my_decimal id +CAST(my_decimal AS DECIMAL(37,2)) my_decimal id NULL NULL 1 -10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2 10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3 @@ -3271,12 +3185,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL(37,2)), my_bigint, id FROM t1_values; -SELECT CAST(my_bigint AS DECIMAL), +SELECT CAST(my_bigint AS DECIMAL(37,2)), my_bigint, id FROM t1_values WHERE select_id = 62 OR select_id IS NULL; -CAST(my_bigint AS DECIMAL) my_bigint id +CAST(my_bigint AS DECIMAL(37,2)) my_bigint id NULL NULL 1 -9223372036854775808.00 -9223372036854775808 2 9223372036854775807.00 9223372036854775807 3 @@ -3284,11 +3198,11 @@ NULL NULL 1 -1.00 -1 5 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal) AS `CAST(my_bigint AS DECIMAL)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal(37,2)) AS `CAST(my_bigint AS DECIMAL(37,2))`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 62 OR select_id IS NULL); -CAST(my_bigint AS DECIMAL) my_bigint id +CAST(my_bigint AS DECIMAL(37,2)) my_bigint id NULL NULL 1 -9223372036854775808.00 -9223372036854775808 2 9223372036854775807.00 9223372036854775807 3 @@ -3297,12 +3211,12 @@ NULL NULL 1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)), my_varbinary_1000, id FROM t1_values; -SELECT CAST(my_varbinary_1000 AS DECIMAL), +SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)), my_varbinary_1000, id FROM t1_values WHERE select_id = 61 OR select_id IS NULL; -CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id +CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 @@ -3315,11 +3229,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal) AS `CAST(my_varbinary_1000 AS DECIMAL)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 61 OR select_id IS NULL); -CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id +CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 @@ -3333,12 +3247,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL(37,2)), my_binary_30, id FROM t1_values; -SELECT CAST(my_binary_30 AS DECIMAL), +SELECT CAST(my_binary_30 AS DECIMAL(37,2)), my_binary_30, id FROM t1_values WHERE select_id = 60 OR select_id IS NULL; -CAST(my_binary_30 AS DECIMAL) my_binary_30 id +CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 @@ -3356,11 +3270,11 @@ Warning 1292 Truncated incorrect DECIMAL value: '-1' Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal) AS `CAST(my_binary_30 AS DECIMAL)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 60 OR select_id IS NULL); -CAST(my_binary_30 AS DECIMAL) my_binary_30 id +CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 @@ -3379,12 +3293,12 @@ Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333' DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)), my_varchar_1000, id FROM t1_values; -SELECT CAST(my_varchar_1000 AS DECIMAL), +SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)), my_varchar_1000, id FROM t1_values WHERE select_id = 59 OR select_id IS NULL; -CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id +CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 @@ -3397,11 +3311,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1 Error 1366 Incorrect decimal value: '' for column '' at row -1 SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal) AS `CAST(my_varchar_1000 AS DECIMAL)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 59 OR select_id IS NULL); -CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id +CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id NULL NULL 1 0.00 2 0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 @@ -3415,12 +3329,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1 DROP VIEW v1; -CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL), +CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL(37,2)), my_char_30, id FROM t1_values; -SELECT CAST(my_char_30 AS DECIMAL), +SELECT CAST(my_char_30 AS DECIMAL(37,2)), my_char_30, id FROM t1_values WHERE select_id = 58 OR select_id IS NULL; -CAST(my_char_30 AS DECIMAL) my_char_30 id +CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 @@ -3436,11 +3350,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1 Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal) AS `CAST(my_char_30 AS DECIMAL)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` SELECT v1.* FROM v1 WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 58 OR select_id IS NULL); -CAST(my_char_30 AS DECIMAL) my_char_30 id +CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id NULL NULL 1 0.00 2 0.00 <--------30 characters-------> 3 diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_0102.result b/mysql-test/suite/funcs_1/r/myisam_trig_0102.result index 4bbee8aa133..6dd56a1e912 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_0102.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_0102.result @@ -237,7 +237,7 @@ create table t1 (f1 integer) engine = myisam; use test; CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 for each row set @ret_trg6_2 = 5; -ERROR HY000: Trigger in wrong schema +ERROR 42S02: Table 'trig_db.tb3' doesn't exist use trig_db; CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3 for each row set @ret_trg6_3 = 18; diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_08.result b/mysql-test/suite/funcs_1/r/myisam_trig_08.result index ec8e12ff32d..8a13e91d71d 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_08.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_08.result @@ -484,9 +484,8 @@ BEGIN WHILE @counter1 < new.f136 SET @counter1 = @counter1 + 1; END// -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHILE @counter1 < new.f136 -SET @counter1 = @counter1 + 1; -END' at line 3 +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET @counter1 = @counter1 + 1; +END' at line 4 delete from tb3 where f122='Test 3.5.8.5-while'; drop trigger trg7; diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_09.result b/mysql-test/suite/funcs_1/r/myisam_trig_09.result index 9643aa567e3..b7a5933e2f7 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_09.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_09.result @@ -194,7 +194,7 @@ a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000 Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL where f122='Test 3.5.9.4'; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'f136' at row 11 +Warning 1048 Column 'f136' cannot be null select f118, f121, f122, f136, f151, f163 from tb3 where f122 like 'Test 3.5.9.4-trig'; f118 f121 f122 f136 f151 f163 diff --git a/mysql-test/suite/funcs_1/r/myisam_views.result b/mysql-test/suite/funcs_1/r/myisam_views.result index 1dbebbccb29..83af04dcd2c 100644 --- a/mysql-test/suite/funcs_1/r/myisam_views.result +++ b/mysql-test/suite/funcs_1/r/myisam_views.result @@ -10224,7 +10224,8 @@ SHOW FIELDS FROM v1; ERROR 42S02: Table 'test.v1' doesn't exist CHECK TABLE v1; Table Op Msg_type Msg_text -test.v1 check error Table 'test.v1' doesn't exist +test.v1 check Error Table 'test.v1' doesn't exist +test.v1 check error Corrupt DESCRIBE v1; ERROR 42S02: Table 'test.v1' doesn't exist EXPLAIN SELECT * FROM v1; diff --git a/mysql-test/suite/funcs_1/triggers/triggers_0102.inc b/mysql-test/suite/funcs_1/triggers/triggers_0102.inc index 26a5dab3370..b11455c07d3 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_0102.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_0102.inc @@ -265,7 +265,7 @@ let $message= Testcase 3.5.1.8:; # Can't create a trigger in a different database use test; - --error 1435 + --error 1146 CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3 for each row set @ret_trg6_2 = 5; diff --git a/mysql-test/suite/funcs_1/views/func_view.inc b/mysql-test/suite/funcs_1/views/func_view.inc index 4479db22e70..c477eafc610 100644 --- a/mysql-test/suite/funcs_1/views/func_view.inc +++ b/mysql-test/suite/funcs_1/views/func_view.inc @@ -609,7 +609,8 @@ let $col_type= my_year; # 1.1.6. CAST --> DECIMAL -let $target_type= DECIMAL; +# Set the following to (37,2) since the default was changed to (10,0) - OBN +let $target_type= DECIMAL(37,2); # let $col_type= my_char_30; --source suite/funcs_1/views/fv_cast.inc From 48e879f9ac3d57b6c931c36a7d590e16229ae1a4 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Jul 2007 18:38:52 +0400 Subject: [PATCH 08/49] Allow mysql.proc to have extra (unknown) fields. This allows 5.0 to work with 5.1 databases. --- sql/sp.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sp.cc b/sql/sp.cc index c0e7d5e2271..75d6fa4618f 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -273,7 +273,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp) if ((ret= db_find_routine_aux(thd, type, name, table)) != SP_OK) goto done; - if (table->s->fields != MYSQL_PROC_FIELD_COUNT) + if (table->s->fields < MYSQL_PROC_FIELD_COUNT) { ret= SP_GET_FIELD_FAILED; goto done; @@ -523,7 +523,7 @@ db_create_routine(THD *thd, int type, sp_head *sp) strxmov(definer, thd->lex->definer->user.str, "@", thd->lex->definer->host.str, NullS); - if (table->s->fields != MYSQL_PROC_FIELD_COUNT) + if (table->s->fields < MYSQL_PROC_FIELD_COUNT) { ret= SP_GET_FIELD_FAILED; goto done; From 2612fc43b53a69320ba41011aa632ec35b734211 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Jul 2007 19:46:50 +0400 Subject: [PATCH 09/49] Patch inspired by BUG#10491: Server returns data as charset binary SHOW CREATE TABLE or SELECT FROM I_S. The problem is that mysqldump generates incorrect dump for a table with non-ASCII column name if the mysqldump's character set is ASCII. The fix is to: 1. Switch character_set_client for the mysqldump's connection to binary before issuing SHOW CREATE TABLE statement in order to avoid conversion. 2. Dump switch character_set_client statements to UTF8 and back for CREATE TABLE statement. client/mysqldump.c: 1. Switch character_set_client for the mysqldump's connection to binary before issuing SHOW CREATE TABLE statement in order to avoid conversion. 2. Dump switch character_set_client statements to UTF8 and back for CREATE TABLE statement. mysql-test/r/mysqldump-max.result: Update result file. mysql-test/r/mysqldump.result: Update result file. mysql-test/r/openssl_1.result: Update result file. mysql-test/r/show_check.result: Update result file. mysql-test/t/show_check.test: Test case: - create a table with non-ASCII column name; - dump the database by mysqldump using ASCII character set; - drop the database; - load the dump; - check that the table has been re-created properly. --- client/mysqldump.c | 30 ++++- mysql-test/r/mysqldump-max.result | 36 ++++++ mysql-test/r/mysqldump.result | 180 ++++++++++++++++++++++++++++++ mysql-test/r/openssl_1.result | 9 ++ mysql-test/r/show_check.result | 20 ++++ mysql-test/t/show_check.test | 57 ++++++++++ 6 files changed, 329 insertions(+), 3 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index f72cb0171e1..c745ca10272 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -992,6 +992,21 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res, return 0; } + +static int switch_character_set_results(MYSQL *mysql, const char *cs_name) +{ + char query_buffer[QUERY_LENGTH]; + size_t query_length; + + query_length= my_snprintf(query_buffer, + sizeof (query_buffer), + "SET SESSION character_set_results = '%s'", + (const char *) cs_name); + + return mysql_real_query(mysql, query_buffer, query_length); +} + + /* Open a new .sql file to dump the table or view into @@ -1671,7 +1686,10 @@ static uint get_table_structure(char *table, char *db, char *table_type, MYSQL_FIELD *field; my_snprintf(buff, sizeof(buff), "show create table %s", result_table); - if (mysql_query_with_error_report(mysql, 0, buff)) + + if (switch_character_set_results(mysql, "binary") || + mysql_query_with_error_report(mysql, &result, buff) || + switch_character_set_results(mysql, default_charset)) DBUG_RETURN(0); if (path) @@ -1702,7 +1720,6 @@ static uint get_table_structure(char *table, char *db, char *table_type, check_io(sql_file); } - result= mysql_store_result(mysql); field= mysql_fetch_field_direct(result, 0); if (strcmp(field->name, "View") == 0) { @@ -1794,7 +1811,14 @@ static uint get_table_structure(char *table, char *db, char *table_type, } row= mysql_fetch_row(result); - fprintf(sql_file, "%s;\n", row[1]); + + fprintf(sql_file, + "SET @saved_cs_client = @@character_set_client;\n" + "SET character_set_client = utf8;\n" + "%s;\n" + "SET character_set_client = @saved_cs_client;\n", + row[1]); + check_io(sql_file); mysql_free_result(result); } diff --git a/mysql-test/r/mysqldump-max.result b/mysql-test/r/mysqldump-max.result index 9ae3e368e28..261c7a7f197 100644 --- a/mysql-test/r/mysqldump-max.result +++ b/mysql-test/r/mysqldump-max.result @@ -93,55 +93,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l USE `test`; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `id` int(8) default NULL, `name` varchar(32) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; INSERT DELAYED IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t1` ENABLE KEYS */; DROP TABLE IF EXISTS `t2`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t2` ( `id` int(8) default NULL, `name` varchar(32) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40000 ALTER TABLE `t2` DISABLE KEYS */; INSERT DELAYED IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t2` ENABLE KEYS */; DROP TABLE IF EXISTS `t3`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t3` ( `id` int(8) default NULL, `name` varchar(32) default NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40000 ALTER TABLE `t3` DISABLE KEYS */; INSERT DELAYED IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t3` ENABLE KEYS */; DROP TABLE IF EXISTS `t4`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t4` ( `id` int(8) default NULL, `name` varchar(32) default NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40000 ALTER TABLE `t4` DISABLE KEYS */; INSERT DELAYED IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t4` ENABLE KEYS */; DROP TABLE IF EXISTS `t5`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t5` ( `id` int(8) default NULL, `name` varchar(32) default NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40000 ALTER TABLE `t5` DISABLE KEYS */; INSERT DELAYED IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t5` ENABLE KEYS */; DROP TABLE IF EXISTS `t6`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t6` ( `id` int(8) default NULL, `name` varchar(32) default NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40000 ALTER TABLE `t6` DISABLE KEYS */; INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); @@ -172,55 +190,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l USE `test`; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `id` int(8) default NULL, `name` varchar(32) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; INSERT DELAYED INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t1` ENABLE KEYS */; DROP TABLE IF EXISTS `t2`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t2` ( `id` int(8) default NULL, `name` varchar(32) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40000 ALTER TABLE `t2` DISABLE KEYS */; INSERT DELAYED INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t2` ENABLE KEYS */; DROP TABLE IF EXISTS `t3`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t3` ( `id` int(8) default NULL, `name` varchar(32) default NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40000 ALTER TABLE `t3` DISABLE KEYS */; INSERT DELAYED INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t3` ENABLE KEYS */; DROP TABLE IF EXISTS `t4`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t4` ( `id` int(8) default NULL, `name` varchar(32) default NULL ) ENGINE=MEMORY DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40000 ALTER TABLE `t4` DISABLE KEYS */; INSERT DELAYED INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t4` ENABLE KEYS */; DROP TABLE IF EXISTS `t5`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t5` ( `id` int(8) default NULL, `name` varchar(32) default NULL ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40000 ALTER TABLE `t5` DISABLE KEYS */; INSERT DELAYED INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t5` ENABLE KEYS */; DROP TABLE IF EXISTS `t6`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t6` ( `id` int(8) default NULL, `name` varchar(32) default NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40000 ALTER TABLE `t6` DISABLE KEYS */; INSERT INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index da05fe7bc5b..73841a2150f 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -28,9 +28,12 @@ DROP TABLE t1; CREATE TABLE t1 (a decimal(64, 20)); INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), ("0987654321098765432109876543210987654321"); +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` decimal(64,20) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('987654321098765432109876543210987654321.00000000000000000000'); DROP TABLE t1; # @@ -40,9 +43,12 @@ CREATE TABLE t1 (a double); INSERT INTO t1 VALUES ('-9e999999'); Warnings: Warning 1264 Out of range value adjusted for column 'a' at row 1 +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` double default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; INSERT INTO `t1` VALUES (RES); DROP TABLE t1; # @@ -58,15 +64,21 @@ INSERT INTO t1 VALUES ('1.2345', 2.3456); INSERT INTO t1 VALUES ("1.2345", 2.3456); ERROR 42S22: Unknown column '1.2345' in 'field list' SET SQL_MODE=@OLD_SQL_MODE; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` decimal(10,5) default NULL, `b` float default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456); +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` decimal(10,5) default NULL, `b` float default NULL ); +SET character_set_client = @saved_cs_client; INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; @@ -80,10 +92,13 @@ INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456) /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` decimal(10,5) default NULL, `b` float default NULL ); +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -106,10 +121,13 @@ UNLOCK TABLES; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` decimal(10,5) default NULL, `b` float default NULL ); +SET character_set_client = @saved_cs_client; INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456); /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -185,9 +203,12 @@ INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` varchar(255) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=koi8r; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -218,9 +239,12 @@ INSERT INTO t1 VALUES (1), (2); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL40' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ) TYPE=MyISAM; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -241,9 +265,12 @@ UNLOCK TABLES; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ) TYPE=MyISAM; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -262,9 +289,12 @@ DROP TABLE t1; # Bug #2592 'mysqldump doesn't quote "tricky" names correctly' # create table ```a` (i int); +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE ```a` ( `i` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; drop table ```a`; # # Bug #2591 "mysqldump quotes names inconsistently" @@ -282,9 +312,12 @@ create table t1(a int); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -307,9 +340,12 @@ UNLOCK TABLES; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS "t1"; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE "t1" ( "a" int(11) default NULL ); +SET character_set_client = @saved_cs_client; LOCK TABLES "t1" WRITE; /*!40000 ALTER TABLE "t1" DISABLE KEYS */; @@ -335,9 +371,12 @@ set global sql_mode='ANSI_QUOTES'; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -360,9 +399,12 @@ UNLOCK TABLES; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS "t1"; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE "t1" ( "a" int(11) default NULL ); +SET character_set_client = @saved_cs_client; LOCK TABLES "t1" WRITE; /*!40000 ALTER TABLE "t1" DISABLE KEYS */; @@ -392,9 +434,12 @@ insert into t1 values (1),(2),(3); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -483,9 +528,12 @@ INSERT INTO t1 VALUES (_latin1 ' /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` char(10) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -516,9 +564,12 @@ UNLOCK TABLES; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` char(10) default NULL ) TYPE=MyISAM; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -539,9 +590,12 @@ UNLOCK TABLES; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` char(10) default NULL ) TYPE=MyISAM; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -562,9 +616,12 @@ UNLOCK TABLES; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` char(10) default NULL ) TYPE=MyISAM; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -598,9 +655,12 @@ INSERT INTO t2 VALUES (4),(5),(6); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t2`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t2` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t2` WRITE; /*!40000 ALTER TABLE `t2` DISABLE KEYS */; @@ -636,9 +696,12 @@ INSERT INTO `t1` VALUES (0x602010000280100005E71A); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `b` blob ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -674,9 +737,12 @@ INSERT INTO t1 VALUES (4),(5),(6); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -705,9 +771,12 @@ UNLOCK TABLES; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; INSERT DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6); @@ -1071,6 +1140,8 @@ insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `F_c4ca4238a0b923820dcc509a6f75849b` int(11) default NULL, `F_c81e728d9d4c2f636f067f89cc14862c` int(11) default NULL, @@ -1403,6 +1474,7 @@ CREATE TABLE `t1` ( `F_6faa8040da20ef399b63a72d0e4ab575` int(11) default NULL, `F_fe73f687e5bc5280214e0486b273a5f9` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -1443,9 +1515,12 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l USE `test`; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -1484,13 +1559,19 @@ INSERT INTO t2 VALUES (1), (2); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `t2`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t2` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -1513,13 +1594,19 @@ CREATE TABLE `t2` ( /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `t2`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t2` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -1719,17 +1806,26 @@ create table t3(a int); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t3`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t3` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `t2`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t2` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -1759,9 +1855,12 @@ mysqldump: Got error: 1064: You have an error in your SQL syntax; check the manu /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -1792,12 +1891,15 @@ insert into t1 values (0815, 4711, 2006); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS "t1"; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE "t1" ( "a b" int(11) NOT NULL default '0', "c""d" int(11) NOT NULL default '0', "e`f" int(11) NOT NULL default '0', PRIMARY KEY ("a b","c""d","e`f") ); +SET character_set_client = @saved_cs_client; LOCK TABLES "t1" WRITE; /*!40000 ALTER TABLE "t1" DISABLE KEYS */; @@ -1823,12 +1925,15 @@ UNLOCK TABLES; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a b` int(11) NOT NULL default '0', `c"d` int(11) NOT NULL default '0', `e``f` int(11) NOT NULL default '0', PRIMARY KEY (`a b`,`c"d`,`e``f`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -1874,10 +1979,13 @@ create view v2 as select * from t2 where a like 'a%' with check option; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t2`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t2` ( `a` varchar(30) default NULL, KEY `a` (`a`(5)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t2` WRITE; /*!40000 ALTER TABLE `t2` DISABLE KEYS */; @@ -1955,9 +2063,12 @@ create view v1 as select * from t1; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -2012,10 +2123,13 @@ create view v2 as select * from t2 where a like 'a%' with check option; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t2`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t2` ( `a` varchar(30) default NULL, KEY `a` (`a`(5)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t2` WRITE; /*!40000 ALTER TABLE `t2` DISABLE KEYS */; @@ -2064,9 +2178,12 @@ INSERT INTO t1 VALUES ('\''); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` char(10) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -2107,11 +2224,14 @@ select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL, `b` int(11) default NULL, `c` varchar(30) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -2227,10 +2347,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l USE `test`; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL, `b` bigint(20) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -2262,9 +2385,12 @@ end */;; DELIMITER ; /*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */; DROP TABLE IF EXISTS `t2`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t2` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t2` WRITE; /*!40000 ALTER TABLE `t2` DISABLE KEYS */; @@ -2307,10 +2433,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l USE `test`; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL, `b` bigint(20) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -2318,9 +2447,12 @@ INSERT INTO `t1` VALUES (1,NULL),(2,NULL),(4,NULL),(11,NULL); /*!40000 ALTER TABLE `t1` ENABLE KEYS */; UNLOCK TABLES; DROP TABLE IF EXISTS `t2`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t2` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t2` WRITE; /*!40000 ALTER TABLE `t2` DISABLE KEYS */; @@ -2444,9 +2576,12 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l USE `test`; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `id` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -2534,10 +2669,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l USE `test`; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `d` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, UNIQUE KEY `d` (`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -2568,10 +2706,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l USE `test`; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `d` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, UNIQUE KEY `d` (`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -2618,9 +2759,12 @@ a2 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS "t1 test"; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE "t1 test" ( "a1" int(11) default NULL ); +SET character_set_client = @saved_cs_client; LOCK TABLES "t1 test" WRITE; /*!40000 ALTER TABLE "t1 test" DISABLE KEYS */; @@ -2636,9 +2780,12 @@ INSERT INTO `t2 test` SET a2 = NEW.a1; END */;; DELIMITER ; /*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */; DROP TABLE IF EXISTS "t2 test"; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE "t2 test" ( "a2" int(11) default NULL ); +SET character_set_client = @saved_cs_client; LOCK TABLES "t2 test" WRITE; /*!40000 ALTER TABLE "t2 test" DISABLE KEYS */; @@ -2687,11 +2834,14 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l USE `test`; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL, `b` varchar(32) default NULL, `c` varchar(32) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -2779,9 +2929,12 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l USE `test`; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -2825,10 +2978,13 @@ insert into t1 values ('',''); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` binary(1) default NULL, `b` blob ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -2857,10 +3013,13 @@ UNLOCK TABLES; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` binary(1) default NULL, `b` blob ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -3015,9 +3174,12 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CH USE `mysqldump_test_db`; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `id` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -3062,11 +3224,14 @@ create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_tables` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `mysqldump_tables`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `basetable` ( `id` bigint(20) unsigned NOT NULL auto_increment, `tag` varchar(64) default NULL, UNIQUE KEY `id` (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHARACTER SET latin1 */; @@ -3134,10 +3299,13 @@ mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SU mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation (1227) grant REPLICATION CLIENT on *.* to mysqltest_1@localhost; CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=537; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL, `b` varchar(34) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; drop table t1; drop user mysqltest_1@localhost; # @@ -3226,22 +3394,31 @@ CREATE TABLE t1 (a int) ENGINE=merge UNION=(t2, t3); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t2`,`t3`); +SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `t2`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t2` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t2` WRITE; /*!40000 ALTER TABLE `t2` DISABLE KEYS */; /*!40000 ALTER TABLE `t2` ENABLE KEYS */; UNLOCK TABLES; DROP TABLE IF EXISTS `t3`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t3` ( `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; LOCK TABLES `t3` WRITE; /*!40000 ALTER TABLE `t3` DISABLE KEYS */; @@ -3317,10 +3494,13 @@ drop database mysqldump_test_db; # CREATE TABLE t1 (c1 INT, c2 LONGBLOB); INSERT INTO t1 SET c1=11, c2=REPEAT('q',509); +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `c1` int(11) default NULL, `c2` longblob ); +SET character_set_client = @saved_cs_client; INSERT INTO `t1` VALUES (11,0x7171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171); DROP TABLE t1; # diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result index 3f10eed7ad7..9c6c29eea47 100644 --- a/mysql-test/r/openssl_1.result +++ b/mysql-test/r/openssl_1.result @@ -77,9 +77,12 @@ INSERT INTO t1 VALUES (1), (2); /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ); +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -108,9 +111,12 @@ UNLOCK TABLES; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ); +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; @@ -139,9 +145,12 @@ UNLOCK TABLES; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; CREATE TABLE `t1` ( `a` int(11) default NULL ); +SET character_set_client = @saved_cs_client; LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index e4cdd4f183b..7e5dc7e61c1 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -1088,6 +1088,26 @@ DROP TABLE t1; DROP VIEW v1; DROP PROCEDURE p1; DROP FUNCTION f1; +set names koi8r; +DROP DATABASE IF EXISTS mysqltest1; +CREATE DATABASE mysqltest1; +use mysqltest1; +CREATE TABLE t1(ËÏÌÏÎËÁ1 INT); + +---> Dumping mysqltest1 to show_check.mysqltest1.sql + + +DROP DATABASE mysqltest1; + + +---> Restoring mysqltest1... +SHOW CREATE TABLE mysqltest1.t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ËÏÌÏÎËÁ1` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP DATABASE mysqltest1; +use test; flush status; show variables like "log_queries_not_using_indexes"; Variable_name Value diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index a58d81a414b..4d470ee4233 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -559,6 +559,10 @@ show status like 'slow_queries'; # FROM I_S. # +# +# Part 1: check that meta-data specifies not-binary character set. +# + # Ensure that all needed objects are dropped. --disable_warnings @@ -766,6 +770,59 @@ DROP VIEW v1; DROP PROCEDURE p1; DROP FUNCTION f1; +# +# Part 2: check that table with non-latin1 characters are dumped/restored +# correctly. +# + +# Ensure that all needed objects are dropped. + +set names koi8r; + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1; +--enable_warnings + +# Create objects. + +CREATE DATABASE mysqltest1; + +use mysqltest1; + +CREATE TABLE t1(ËÏÌÏÎËÁ1 INT); + +# Check: +# - Dump mysqltest1; + +--echo +--echo ---> Dumping mysqltest1 to show_check.mysqltest1.sql + +--exec $MYSQL_DUMP --default-character-set=latin1 --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql + +# - Clean mysqltest1; + +--echo +--echo + +DROP DATABASE mysqltest1; + +# - Restore mysqltest1; + +--echo +--echo + +--echo ---> Restoring mysqltest1... +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql + +# - Check definition of the table. + +SHOW CREATE TABLE mysqltest1.t1; + +# Cleanup. + +DROP DATABASE mysqltest1; +use test; + # # Bug #28808: log_queries_not_using_indexes variable dynamic change is ignored # From a34879ebd2c6c02f77a2df080c4696f0039ebffa Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Jul 2007 13:18:12 -0400 Subject: [PATCH 10/49] Bug#24732 Executables do not include Vista manifests - Sign executables with MySQL AB security certificate. BitKeeper/etc/ignore: Bug#24732 Executables do not include Vista manifests - Ignore security catalog descriptions CMakeLists.txt: Bug#24732 Executables do not include Vista manifests - Search for additional tools necessary to embed, catalog and sign targets. win/README: Bug#24732 Executables do not include Vista manifests - Add internal only note to EMBED_MANIFESTS option. win/create_manifest.js: Bug#24732 Executables do not include Vista manifests - Added publicKeyToken attribute to manifest. win/mysql_manifest.cmake: Bug#24732 Executables do not include Vista manifests - Add additional commands to create security catalog and sign targets. - Add parameters to add appropiate hash attribute to manifest and create security content description of the security catalog. --- .bzrignore | 1 + CMakeLists.txt | 38 ++++++++++++++++++++++++++++++++------ win/README | 3 ++- win/create_manifest.js | 2 +- win/mysql_manifest.cmake | 7 ++++--- 5 files changed, 40 insertions(+), 11 deletions(-) diff --git a/.bzrignore b/.bzrignore index e7a7a1c27dc..759ca4a20bf 100644 --- a/.bzrignore +++ b/.bzrignore @@ -6,6 +6,7 @@ *.bin *.vcproj.cmake cmake_install.cmake +*.cdf *.core *.d *.da diff --git a/CMakeLists.txt b/CMakeLists.txt index cdd0cde8b8d..3703548ebc3 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,21 +139,47 @@ ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D _CRT_SECURE_NO_DEPRECATE") IF(EMBED_MANIFESTS) - # Search for the Manifest tool. CMake will first search it's defaults - # (CMAKE_FRAMEWORK_PATH, CMAKE_APPBUNDLE_PATH, CMAKE_PROGRAM_PATH and - # the system PATH) followed by the listed paths which are the current - # possible defaults and should be updated when necessary. The custom - # manifests are designed to be compatible with all mt versions. + # Search for the tools (mt, makecat, signtool) necessary for embedding + # manifests and signing executables with the MySQL AB authenticode cert. + # + # CMake will first search it's defaults (CMAKE_FRAMEWORK_PATH, + # CMAKE_APPBUNDLE_PATH, CMAKE_PROGRAM_PATH and the system PATH) followed + # by the listed paths which are the current possible defaults and should be + # updated when necessary. + # + # The custom manifests are designed to be compatible with all mt versions. + # The MySQL AB Authenticode certificate is available only internally. + # Others should store a single signing certificate in a local cryptographic + # service provider and alter the signtool command as necessary. FIND_PROGRAM(HAVE_MANIFEST_TOOL NAMES mt PATHS "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/VC/bin" "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin" "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin") + FIND_PROGRAM(HAVE_CATALOG_TOOL NAMES makecat + PATHS + "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin") + FIND_PROGRAM(HAVE_SIGN_TOOL NAMES signtool + PATHS + "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/Common7/Tools/Bin" + "$ENV{PROGRAMFILES}/Microsoft Visual Studio 8/SDK/v2.0/Bin") + IF(HAVE_MANIFEST_TOOL) - MESSAGE(STATUS "Found Mainfest Tool. Embedding custom manifests.") + MESSAGE(STATUS "Found Mainfest Tool.") ELSE(HAVE_MANIFEST_TOOL) MESSAGE(FATAL_ERROR "Manifest tool, mt.exe, can't be found.") ENDIF(HAVE_MANIFEST_TOOL) + IF(HAVE_CATALOG_TOOL) + MESSAGE(STATUS "Found Catalog Tool.") + ELSE(HAVE_CATALOG_TOOL) + MESSAGE(FATAL_ERROR "Catalog tool, makecat.exe, can't be found.") + ENDIF(HAVE_CATALOG_TOOL) + IF(HAVE_SIGN_TOOL) + MESSAGE(STATUS "Found Sign Tool. Embedding custom manifests and signing executables.") + ELSE(HAVE_SIGN_TOOL) + MESSAGE(FATAL_ERROR "Sign tool, signtool.exe, can't be found.") + ENDIF(HAVE_SIGN_TOOL) + # Disable automatic manifest generation. STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}) diff --git a/win/README b/win/README index 118d619226a..d13f37965c1 100644 --- a/win/README +++ b/win/README @@ -51,7 +51,8 @@ The options right now are DISABLE_GRANT_OPTIONS Disables the use of --init-file and --skip-grant-tables options of mysqld.exe EMBED_MANIFESTS Embed custom manifests into final exes, otherwise VS - default will be used. + default will be used. (Note - This option should only be + used by MySQL AB.) So the command line could look like: diff --git a/win/create_manifest.js b/win/create_manifest.js index 8569bd508ff..dec8f6e62e2 100755 --- a/win/create_manifest.js +++ b/win/create_manifest.js @@ -56,7 +56,7 @@ try manifest_xml+= "\t Date: Wed, 25 Jul 2007 22:29:53 +0200 Subject: [PATCH 11/49] tmp_table_size is not about user-created temporary tables, only internal ones (like those of GROUP BY): fixing the --help text. sql/mysqld.cc: tmp_table_size is not about user-created temporary tables, only internal ones (like those of GROUP BY) --- sql/mysqld.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 61980fa1887..9eb3d157dcf 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6181,7 +6181,8 @@ The minimum value for this variable is 4096.", (gptr*) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME], 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"tmp_table_size", OPT_TMP_TABLE_SIZE, - "If an in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table.", + "If an internal in-memory temporary table exceeds this size, MySQL will" + " automatically convert it to an on-disk MyISAM table.", (gptr*) &global_system_variables.tmp_table_size, (gptr*) &max_system_variables.tmp_table_size, 0, GET_ULL, REQUIRED_ARG, 32*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0}, From 5babac539d03b4bb9aff2f74965b98c8506726e5 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Jul 2007 11:31:10 +0300 Subject: [PATCH 12/49] Bug #29571: INSERT DELAYED IGNORE written to binary log on the master but on the slave MySQL can decide to "downgrade" a INSERT DELAYED statement to normal insert in certain situations. One such situation is when the slave is replaying a replication feed. However INSERT DELAYED is logged even if there're no updates whereas the NORMAL INSERT is not logged in such cases. Fixed by always logging a "downgraded" INSERT DELAYED: even if there were no updates. mysql-test/r/rpl_insert_delayed.result: Bug #29571: test case mysql-test/t/rpl_insert_delayed.test: Bug #29571: test case sql/sql_insert.cc: Bug #29571: log INSERT DELAYED even if it was "downgraded" to INSERT (and there were no updates) --- mysql-test/r/rpl_insert_delayed.result | 20 ++++++++++++++++++ mysql-test/t/rpl_insert_delayed.test | 29 ++++++++++++++++++++++++++ sql/sql_insert.cc | 9 +++++--- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/rpl_insert_delayed.result b/mysql-test/r/rpl_insert_delayed.result index 38e2cddd650..ddf6e9c2165 100644 --- a/mysql-test/r/rpl_insert_delayed.result +++ b/mysql-test/r/rpl_insert_delayed.result @@ -29,3 +29,23 @@ id name 10 my name 20 is Bond drop table t1; +CREATE TABLE t1(a int, UNIQUE(a)); +INSERT DELAYED IGNORE INTO t1 VALUES(1); +INSERT DELAYED IGNORE INTO t1 VALUES(1); +show binlog events limit 11,100; +Log_name Pos Event_type Server_id End_log_pos Info +x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1) +x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1) +select * from t1; +a +1 +On slave +show binlog events limit 12,100; +Log_name Pos Event_type Server_id End_log_pos Info +x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1) +x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1) +select * from t1; +a +1 +drop table t1; +End of 5.0 tests diff --git a/mysql-test/t/rpl_insert_delayed.test b/mysql-test/t/rpl_insert_delayed.test index 3f72f3a3625..141f36a694a 100644 --- a/mysql-test/t/rpl_insert_delayed.test +++ b/mysql-test/t/rpl_insert_delayed.test @@ -65,3 +65,32 @@ connection master; drop table t1; sync_slave_with_master; connection master; + +# +# Bug #29571: INSERT DELAYED IGNORE written to binary log on the master but +# on the slave +# +CREATE TABLE t1(a int, UNIQUE(a)); +INSERT DELAYED IGNORE INTO t1 VALUES(1); +INSERT DELAYED IGNORE INTO t1 VALUES(1); + +#must show two INSERT DELAYED +--replace_column 1 x 2 x 3 x 4 x 5 x +show binlog events limit 11,100; +select * from t1; + +sync_slave_with_master; +echo On slave; +#must show two INSERT DELAYED +--replace_column 1 x 2 x 3 x 4 x 5 x +show binlog events limit 12,100; +select * from t1; + + +# clean up +connection master; +drop table t1; +sync_slave_with_master; +connection master; + +--echo End of 5.0 tests diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 73f8c5e4418..618ba62ef19 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -560,6 +560,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, int error, res; bool transactional_table, joins_freed= FALSE; bool changed; + bool was_insert_delayed= (table_list->lock_type == TL_WRITE_DELAYED); uint value_count; ulong counter = 1; ulonglong id; @@ -859,14 +860,16 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, transactional_table= table->file->has_transactions(); - if ((changed= (info.copied || info.deleted || info.updated))) + if ((changed= (info.copied || info.deleted || info.updated)) || + was_insert_delayed) { /* Invalidate the table in the query cache if something changed. For the transactional algorithm to work the invalidation must be before binlog writing and ha_autocommit_or_rollback */ - query_cache_invalidate3(thd, table_list, 1); + if (changed) + query_cache_invalidate3(thd, table_list, 1); if (error <= 0 || !transactional_table) { if (mysql_bin_log.is_open()) @@ -904,7 +907,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, if (mysql_bin_log.write(&qinfo) && transactional_table) error=1; } - if (!transactional_table) + if (!transactional_table && changed) thd->no_trans_update.all= TRUE; } } From 00d694a900c6fcb2f7f1fe37b3a3c189c7f711dd Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Jul 2007 12:52:13 +0200 Subject: [PATCH 13/49] Raise the 64 character limit for path names in the error messages to 150 or 107 characters for those messages which are generated by the embedded server during release builds. This fixes bug#16635: Error messages wrong: absolute path names, "%s" format code See the bug report or the changelog for "sql/share/english/errmsg.txt" for instructions how to do that with other languages, even at the customer site, and for the restrictions to keep. sql/share/english/errmsg.txt: The embedded server uses absolute path names in its error messages, in the release build environment these exceed the 64 character limit which the format strings for the error messages impose (bug#16635). But when the messages are output, the server does the "printf()" internally in a 256 character buffer; the constant text and the expanded variables (strings, error number) must fit into this. (If the buffer would overflow, a format specification will not be expanded but just copied with its code, and the message output will just contain '%s' or '%d' where a value is expected.) So the string lengths are increased to 150 characters in those messages which are issued by the embedded server during release tests and contain 1 (one) path name, but only to 107 in the "rename" message which contains 2 (two). This solves bug#16635 for the release builds. For other languages used by OEM customers, similar fixes may be needed, but we cannot test them. These fixes can be done even in a binary installation at the customer site by following these steps: cd <>/share $EDITOR <>/errmsg.txt ../../bin/comp_err -C./charsets/ <>/errmsg.txt <>/errmsg.sys and then restarting the server. --- sql/share/english/errmsg.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 62c8f4f9991..d3a611529f2 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -21,7 +21,7 @@ character-set=latin1 "NO", "YES", "Can't create file '%-.64s' (errno: %d)", -"Can't create table '%-.64s' (errno: %d)", +"Can't create table '%-.150s' (errno: %d)", "Can't create database '%-.64s' (errno: %d)", "Can't create database '%-.64s'; database exists", "Can't drop database '%-.64s'; database doesn't exist", @@ -33,7 +33,7 @@ character-set=latin1 "Can't get working directory (errno: %d)", "Can't lock file (errno: %d)", "Can't open file: '%-.64s' (errno: %d)", -"Can't find file: '%-.64s' (errno: %d)", +"Can't find file: '%-.150s' (errno: %d)", "Can't read dir of '%-.64s' (errno: %d)", "Can't change dir to '%-.64s' (errno: %d)", "Record has changed since last read in table '%-.64s'", @@ -41,7 +41,7 @@ character-set=latin1 "Can't write; duplicate key in table '%-.64s'", "Error on close of '%-.64s' (errno: %d)", "Error reading file '%-.64s' (errno: %d)", -"Error on rename of '%-.64s' to '%-.64s' (errno: %d)", +"Error on rename of '%-.107s' to '%-.107s' (errno: %d)", "Error writing file '%-.64s' (errno: %d)", "'%-.64s' is locked against change", "Sort aborted", From 17136906c68846618c846a5723a16d683aa8e0a0 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Jul 2007 12:57:46 +0200 Subject: [PATCH 14/49] Clean up the mysql_install_db script to ensure that a sane environment is available and reduce the chance of failure. This should fix bug#28585 which is caused by the script being quite random in how it finds files it requires and not giving very good feedback to the user about what went wrong. Also update make_binary_distribution so that it provides the correct path to the required SQL scripts when generating mysql_install_db. The script only previously worked because of the permissive behaviour which looked around the current working directory before the "correct" location. This could lead to severe problems if the user happened to run the script from a location which contained older or even broken copies of the SQL scripts. We now require either a complete binary release (and the mysql_install_db script ran from inside the extracted archive), or an installed compiled tree, as this is the only way we can be sure everything that we need is available and ready to run. While working on this fix, also clean up the mysql_install_db script a lot to make it simpler, easier to read, and hopefully less prone to bugs in the future. scripts/make_binary_distribution.sh: SQL files live in ./share not ./support-files in binary distribution. scripts/mysql_install_db.sh: Use a consistent shell indentation style. --- scripts/make_binary_distribution.sh | 2 +- scripts/mysql_install_db.sh | 274 ++++++++++++++-------------- 2 files changed, 136 insertions(+), 140 deletions(-) diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 9584721682f..dab1bbec956 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -318,7 +318,7 @@ if [ $BASE_SYSTEM != "netware" ] ; then copyfileto $BASE/bin scripts/* $BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ \ ./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ \ - @HOSTNAME@ \@pkgdatadir\@ ./support-files \ + @HOSTNAME@ \@pkgdatadir\@ ./share \ < scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db $BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \ \@sbindir\@ ./bin \@libexecdir\@ ./bin \ diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 934d245db15..c5d532ee4ed 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -18,26 +18,65 @@ # # All unrecognized arguments to this script are passed to mysqld. +force=0 in_rpm=0 +ip_only=0 windows=0 -defaults="" -user="" case "$1" in - --no-defaults|--defaults-file=*|--defaults-extra-file=*) - defaults="$1"; shift - ;; + --no-defaults|--defaults-file=*|--defaults-extra-file=*) + defaults="$1"; shift + ;; esac +usage() +{ + cat <&1` if [ $? -ne 0 ] @@ -244,39 +247,35 @@ then fi fi -if test "$ip_only" = "1" +if test "$ip_only" -eq 1 then - ip=`echo "$resolved" | awk '/ /{print $6}'` - hostname=$ip + hostname=`echo "$resolved" | awk '/ /{print $6}'` fi # Create database directories mysql & test -if test ! -d $ldata; then - mkdir $ldata; - chmod 700 $ldata ; -fi -if test ! -d $ldata/mysql; then - mkdir $ldata/mysql; - chmod 700 $ldata/mysql ; -fi -if test ! -d $ldata/test; then - mkdir $ldata/test; - chmod 700 $ldata/test ; -fi -if test -w / -a ! -z "$user"; then - chown $user $ldata $ldata/mysql $ldata/test; -fi +for dir in $ldata $ldata/mysql $ldata/test +do + if test ! -d $dir + then + mkdir -p $dir + chmod 700 $dir + fi + if test -w / -a ! -z "$user" + then + chown $user $dir + fi +done -if test -n "$user"; then +if test -n "$user" +then args="$args --user=$user" fi # Peform the install of system tables mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}" mysqld_install_cmd_line="$mysqld_bootstrap $defaults $mysqld_opt --bootstrap \ ---basedir=$basedir --datadir=$ldata --skip-innodb \ ---skip-bdb --skip-ndbcluster $args --max_allowed_packet=8M \ ---net_buffer_length=16K" + --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb \ + --skip-ndbcluster $args --max_allowed_packet=8M --net_buffer_length=16K" # Pipe mysql_system_tables.sql to "mysqld --bootstrap" s_echo "Installing MySQL system tables..." @@ -284,23 +283,20 @@ if `(echo "use mysql;"; cat $create_system_tables $fill_system_tables) | $mysqld then s_echo "OK" - if test -n "$fill_help_tables" + s_echo "Filling help tables..." + # Pipe fill_help_tables.sql to "mysqld --bootstrap" + if `(echo "use mysql;"; cat $fill_help_tables) | $mysqld_install_cmd_line` then - s_echo "Filling help tables..." - # Pipe fill_help_tables.sql to "mysqld --bootstrap" - if `(echo "use mysql;"; cat $fill_help_tables) | $mysqld_install_cmd_line` - then - # Fill suceeded - s_echo "OK" - else - echo "" - echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!" - echo "The \"HELP\" command might not work properly" - echo "" - fi + # Fill suceeded + s_echo "OK" + else + echo + echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!" + echo "The \"HELP\" command might not work properly" + echo fi - s_echo "" + s_echo s_echo "To start mysqld at boot time you have to copy" s_echo "support-files/mysql.server to the right place for your system" s_echo @@ -319,7 +315,7 @@ then echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'" echo "See the manual for more instructions." - if test "$in_rpm" = "0" + if test "$in_rpm" -eq 0 then echo "You can start the MySQL daemon with:" echo "cd @prefix@ ; $bindir/mysqld_safe &" From 82bbaaf6b1d228aaf162749882830a21b45e41d4 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Jul 2007 14:27:36 +0200 Subject: [PATCH 15/49] Apply a few more cleanups to improve the robustness of mysql_install_db scripts/mysql_install_db.sh: Put back variable initialisation for those which could be passed in via the environment and confuse the script. --- scripts/mysql_install_db.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index c5d532ee4ed..760ece5aaed 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -18,6 +18,15 @@ # # All unrecognized arguments to this script are passed to mysqld. +basedir="" +ldata="" +srcdir="" + +args="" +defaults="" +mysqld_opt="" +user="" + force=0 in_rpm=0 ip_only=0 @@ -87,7 +96,8 @@ parse_arguments() shift fi - for arg do + for arg + do case "$arg" in --force) force=1 ;; --basedir=*) basedir=`parse_arg "$arg"` ;; @@ -203,11 +213,10 @@ then mysqld="./sql/mysqld" if test -n "$srcdir" -a -f "$srcdir/sql/share/english/errmsg.sys" then - langdir="$srcdir/sql/share/english" + mysqld_opt="--language=$srcdir/sql/share/english" else - langdir="./sql/share/english" + mysqld_opt="./sql/share/english" fi - mysqld_opt="--language=$langdir" fi # Make sure mysqld is available in default location (--basedir option is From 8f5b02541e6000d920c17ad000342d512e8aca5d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Jul 2007 14:31:11 +0200 Subject: [PATCH 16/49] mysql_install_db.sh: Fix error in previous change, correct --language argument. scripts/mysql_install_db.sh: Fix error in previous change, correct --language argument. --- scripts/mysql_install_db.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 760ece5aaed..7e1f6217b7b 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -215,7 +215,7 @@ then then mysqld_opt="--language=$srcdir/sql/share/english" else - mysqld_opt="./sql/share/english" + mysqld_opt="--language=./sql/share/english" fi fi From f2a91e55c8c522877c1af0dd99b6300b3f4d5f01 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Jul 2007 16:59:21 +0300 Subject: [PATCH 17/49] Addendum to bug 29571: wait for INSERT DELAYED to finish on master --- mysql-test/r/rpl_insert_delayed.result | 3 +++ mysql-test/t/rpl_insert_delayed.test | 1 + 2 files changed, 4 insertions(+) diff --git a/mysql-test/r/rpl_insert_delayed.result b/mysql-test/r/rpl_insert_delayed.result index ddf6e9c2165..6815a727fd7 100644 --- a/mysql-test/r/rpl_insert_delayed.result +++ b/mysql-test/r/rpl_insert_delayed.result @@ -32,10 +32,12 @@ drop table t1; CREATE TABLE t1(a int, UNIQUE(a)); INSERT DELAYED IGNORE INTO t1 VALUES(1); INSERT DELAYED IGNORE INTO t1 VALUES(1); +flush table t1; show binlog events limit 11,100; Log_name Pos Event_type Server_id End_log_pos Info x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1) x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1) +x x x x x use `test`; flush table t1 select * from t1; a 1 @@ -44,6 +46,7 @@ show binlog events limit 12,100; Log_name Pos Event_type Server_id End_log_pos Info x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1) x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1) +x x x x x use `test`; flush table t1 select * from t1; a 1 diff --git a/mysql-test/t/rpl_insert_delayed.test b/mysql-test/t/rpl_insert_delayed.test index 141f36a694a..09e0c5cc2e9 100644 --- a/mysql-test/t/rpl_insert_delayed.test +++ b/mysql-test/t/rpl_insert_delayed.test @@ -73,6 +73,7 @@ connection master; CREATE TABLE t1(a int, UNIQUE(a)); INSERT DELAYED IGNORE INTO t1 VALUES(1); INSERT DELAYED IGNORE INTO t1 VALUES(1); +flush table t1; # to wait for INSERT DELAYED to be done #must show two INSERT DELAYED --replace_column 1 x 2 x 3 x 4 x 5 x From d8c8c3437f0ee875f9738bb065d8d64a195af43a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Jul 2007 17:25:03 +0200 Subject: [PATCH 18/49] Remove the "row_lock" suite from the sources. For more information, see WL#3866 and the bugs numbered 28685 and 20390. BitKeeper/deleted/.del-readme.txt: Delete: mysql-test/suite/row_lock/readme.txt BitKeeper/deleted/.del-summary_of_sel_test.txt: Delete: mysql-test/suite/row_lock/summary_of_sel_test.txt BitKeeper/deleted/.del-innodb_row_lock_1.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_1.result BitKeeper/deleted/.del-innodb_row_lock_2.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_2.result BitKeeper/deleted/.del-innodb_row_lock_3.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_3.result BitKeeper/deleted/.del-innodb_row_lock_4.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_4.result BitKeeper/deleted/.del-innodb_row_lock_5.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_5.result BitKeeper/deleted/.del-innodb_row_lock_big_tab.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result BitKeeper/deleted/.del-innodb_row_lock_big_tab_1.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result BitKeeper/deleted/.del-innodb_row_lock_big_tab_2.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result BitKeeper/deleted/.del-innodb_row_lock_trig_1.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result BitKeeper/deleted/.del-innodb_row_lock_trig_2.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result BitKeeper/deleted/.del-innodb_row_lock_view_1.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result BitKeeper/deleted/.del-row_lock.inc: Delete: mysql-test/suite/row_lock/include/row_lock.inc BitKeeper/deleted/.del-row_lock_big_tab.inc: Delete: mysql-test/suite/row_lock/include/row_lock_big_tab.inc BitKeeper/deleted/.del-row_lock_big_tab_1.inc: Delete: mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc BitKeeper/deleted/.del-row_lock_big_tab_2.inc: Delete: mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc BitKeeper/deleted/.del-row_lock_trig.inc: Delete: mysql-test/suite/row_lock/include/row_lock_trig.inc BitKeeper/deleted/.del-row_lock_view.inc: Delete: mysql-test/suite/row_lock/include/row_lock_view.inc BitKeeper/deleted/.del-row_lock_view_mix.inc: Delete: mysql-test/suite/row_lock/include/row_lock_view_mix.inc BitKeeper/deleted/.del-row_lock_view_storedp.inc: Delete: mysql-test/suite/row_lock/include/row_lock_view_storedp.inc BitKeeper/deleted/.del-row_lock_view_trig.inc: Delete: mysql-test/suite/row_lock/include/row_lock_view_trig.inc BitKeeper/deleted/.del-innodb_row_lock_view_2.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result BitKeeper/deleted/.del-innodb_row_lock_view_mix_1.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result BitKeeper/deleted/.del-innodb_row_lock_view_mix_2.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result BitKeeper/deleted/.del-innodb_row_lock_view_storedp_1.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result BitKeeper/deleted/.del-innodb_row_lock_view_storedp_2.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result BitKeeper/deleted/.del-innodb_row_lock_view_trig_1.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result BitKeeper/deleted/.del-innodb_row_lock_view_trig_2.result: Delete: mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result BitKeeper/deleted/.del-ndb_row_lock_1.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_1.result BitKeeper/deleted/.del-ndb_row_lock_2.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_2.result BitKeeper/deleted/.del-ndb_row_lock_3.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_3.result BitKeeper/deleted/.del-ndb_row_lock_4.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_4.result BitKeeper/deleted/.del-ndb_row_lock_5.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_5.result BitKeeper/deleted/.del-ndb_row_lock_big_tab.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result BitKeeper/deleted/.del-ndb_row_lock_big_tab_1.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result BitKeeper/deleted/.del-ndb_row_lock_big_tab_2.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result BitKeeper/deleted/.del-ndb_row_lock_trig_1.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result BitKeeper/deleted/.del-ndb_row_lock_trig_2.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result BitKeeper/deleted/.del-ndb_row_lock_view_1.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result BitKeeper/deleted/.del-ndb_row_lock_view_2.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result BitKeeper/deleted/.del-innodb_row_lock_1.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_1.test BitKeeper/deleted/.del-innodb_row_lock_2.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_2.test BitKeeper/deleted/.del-innodb_row_lock_3.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_3.test BitKeeper/deleted/.del-innodb_row_lock_4.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_4.test BitKeeper/deleted/.del-innodb_row_lock_5.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_5.test BitKeeper/deleted/.del-innodb_row_lock_big_tab.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test BitKeeper/deleted/.del-innodb_row_lock_big_tab_1.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test BitKeeper/deleted/.del-innodb_row_lock_big_tab_2.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test BitKeeper/deleted/.del-innodb_row_lock_trig_1.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test BitKeeper/deleted/.del-innodb_row_lock_trig_2.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test BitKeeper/deleted/.del-innodb_row_lock_view_1.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test BitKeeper/deleted/.del-innodb_row_lock_view_2.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test BitKeeper/deleted/.del-innodb_row_lock_view_mix_1.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test BitKeeper/deleted/.del-ndb_row_lock_view_mix_1.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result BitKeeper/deleted/.del-ndb_row_lock_view_mix_2.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result BitKeeper/deleted/.del-ndb_row_lock_view_storedp_1.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result BitKeeper/deleted/.del-ndb_row_lock_view_storedp_2.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result BitKeeper/deleted/.del-ndb_row_lock_view_trig_1.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result BitKeeper/deleted/.del-ndb_row_lock_view_trig_2.result: Delete: mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result BitKeeper/deleted/.del-innodb_row_lock_view_mix_2.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test BitKeeper/deleted/.del-innodb_row_lock_view_storedp_1.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test BitKeeper/deleted/.del-innodb_row_lock_view_storedp_2.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test BitKeeper/deleted/.del-innodb_row_lock_view_trig_1.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test BitKeeper/deleted/.del-innodb_row_lock_view_trig_2.test: Delete: mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test BitKeeper/deleted/.del-ndb_row_lock_1.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_1.test BitKeeper/deleted/.del-ndb_row_lock_2.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_2.test BitKeeper/deleted/.del-ndb_row_lock_3.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_3.test BitKeeper/deleted/.del-ndb_row_lock_4.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_4.test BitKeeper/deleted/.del-ndb_row_lock_5.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_5.test BitKeeper/deleted/.del-ndb_row_lock_big_tab.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test BitKeeper/deleted/.del-ndb_row_lock_big_tab_1.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test BitKeeper/deleted/.del-ndb_row_lock_big_tab_2.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test BitKeeper/deleted/.del-ndb_row_lock_trig_1.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test BitKeeper/deleted/.del-ndb_row_lock_trig_2.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test BitKeeper/deleted/.del-ndb_row_lock_view_1.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test BitKeeper/deleted/.del-ndb_row_lock_view_2.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test BitKeeper/deleted/.del-ndb_row_lock_view_mix_1.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test BitKeeper/deleted/.del-ndb_row_lock_view_mix_2.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test BitKeeper/deleted/.del-ndb_row_lock_view_storedp_1.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test BitKeeper/deleted/.del-ndb_row_lock_view_storedp_2.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test BitKeeper/deleted/.del-ndb_row_lock_view_trig_1.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test BitKeeper/deleted/.del-ndb_row_lock_view_trig_2.test: Delete: mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test Makefile.am: Remove the "row_lock" suite from the "test-bt" target. Also, a formatting change: empty line for better readability. --- Makefile.am | 3 +- .../suite/row_lock/include/row_lock.inc | 83 ---- .../row_lock/include/row_lock_big_tab.inc | 94 ----- .../row_lock/include/row_lock_big_tab_1.inc | 93 ----- .../row_lock/include/row_lock_big_tab_2.inc | 93 ----- .../suite/row_lock/include/row_lock_trig.inc | 96 ----- .../suite/row_lock/include/row_lock_view.inc | 89 ----- .../row_lock/include/row_lock_view_mix.inc | 92 ----- .../include/row_lock_view_storedp.inc | 126 ------- .../row_lock/include/row_lock_view_trig.inc | 99 ----- .../suite/row_lock/r/innodb_row_lock_1.result | 142 ------- .../suite/row_lock/r/innodb_row_lock_2.result | 32 -- .../suite/row_lock/r/innodb_row_lock_3.result | 32 -- .../suite/row_lock/r/innodb_row_lock_4.result | 142 ------- .../suite/row_lock/r/innodb_row_lock_5.result | 32 -- .../row_lock/r/innodb_row_lock_big_tab.result | 97 ----- .../r/innodb_row_lock_big_tab_1.result | 145 ------- .../r/innodb_row_lock_big_tab_2.result | 113 ------ .../row_lock/r/innodb_row_lock_trig_1.result | 151 -------- .../row_lock/r/innodb_row_lock_trig_2.result | 37 -- .../row_lock/r/innodb_row_lock_view_1.result | 34 -- .../row_lock/r/innodb_row_lock_view_2.result | 40 -- .../r/innodb_row_lock_view_mix_1.result | 48 --- .../r/innodb_row_lock_view_mix_2.result | 40 -- .../r/innodb_row_lock_view_storedp_1.result | 312 --------------- .../r/innodb_row_lock_view_storedp_2.result | 47 --- .../r/innodb_row_lock_view_trig_1.result | 183 --------- .../r/innodb_row_lock_view_trig_2.result | 38 -- .../suite/row_lock/r/ndb_row_lock_1.result | 139 ------- .../suite/row_lock/r/ndb_row_lock_2.result | 31 -- .../suite/row_lock/r/ndb_row_lock_3.result | 30 -- .../suite/row_lock/r/ndb_row_lock_4.result | 139 ------- .../suite/row_lock/r/ndb_row_lock_5.result | 30 -- .../row_lock/r/ndb_row_lock_big_tab.result | 177 --------- .../row_lock/r/ndb_row_lock_big_tab_1.result | 357 ------------------ .../row_lock/r/ndb_row_lock_big_tab_2.result | 255 ------------- .../row_lock/r/ndb_row_lock_trig_1.result | 148 -------- .../row_lock/r/ndb_row_lock_trig_2.result | 35 -- .../row_lock/r/ndb_row_lock_view_1.result | 194 ---------- .../row_lock/r/ndb_row_lock_view_2.result | 200 ---------- .../row_lock/r/ndb_row_lock_view_mix_1.result | 169 --------- .../row_lock/r/ndb_row_lock_view_mix_2.result | 38 -- .../r/ndb_row_lock_view_storedp_1.result | 309 --------------- .../r/ndb_row_lock_view_storedp_2.result | 46 --- .../r/ndb_row_lock_view_trig_1.result | 180 --------- .../r/ndb_row_lock_view_trig_2.result | 36 -- mysql-test/suite/row_lock/readme.txt | 9 - .../suite/row_lock/summary_of_sel_test.txt | 36 -- .../suite/row_lock/t/innodb_row_lock_1.test | 9 - .../suite/row_lock/t/innodb_row_lock_2.test | 9 - .../suite/row_lock/t/innodb_row_lock_3.test | 9 - .../suite/row_lock/t/innodb_row_lock_4.test | 9 - .../suite/row_lock/t/innodb_row_lock_5.test | 9 - .../row_lock/t/innodb_row_lock_big_tab.test | 9 - .../row_lock/t/innodb_row_lock_big_tab_1.test | 10 - .../row_lock/t/innodb_row_lock_big_tab_2.test | 10 - .../row_lock/t/innodb_row_lock_trig_1.test | 9 - .../row_lock/t/innodb_row_lock_trig_2.test | 9 - .../row_lock/t/innodb_row_lock_view_1.test | 9 - .../row_lock/t/innodb_row_lock_view_2.test | 9 - .../t/innodb_row_lock_view_mix_1.test | 9 - .../t/innodb_row_lock_view_mix_2.test | 10 - .../t/innodb_row_lock_view_storedp_1.test | 9 - .../t/innodb_row_lock_view_storedp_2.test | 9 - .../t/innodb_row_lock_view_trig_1.test | 9 - .../t/innodb_row_lock_view_trig_2.test | 9 - .../suite/row_lock/t/ndb_row_lock_1.test | 6 - .../suite/row_lock/t/ndb_row_lock_2.test | 6 - .../suite/row_lock/t/ndb_row_lock_3.test | 6 - .../suite/row_lock/t/ndb_row_lock_4.test | 6 - .../suite/row_lock/t/ndb_row_lock_5.test | 6 - .../row_lock/t/ndb_row_lock_big_tab.test | 6 - .../row_lock/t/ndb_row_lock_big_tab_1.test | 7 - .../row_lock/t/ndb_row_lock_big_tab_2.test | 7 - .../suite/row_lock/t/ndb_row_lock_trig_1.test | 6 - .../suite/row_lock/t/ndb_row_lock_trig_2.test | 6 - .../suite/row_lock/t/ndb_row_lock_view_1.test | 7 - .../suite/row_lock/t/ndb_row_lock_view_2.test | 6 - .../row_lock/t/ndb_row_lock_view_mix_1.test | 6 - .../row_lock/t/ndb_row_lock_view_mix_2.test | 6 - .../t/ndb_row_lock_view_storedp_1.test | 6 - .../t/ndb_row_lock_view_storedp_2.test | 6 - .../row_lock/t/ndb_row_lock_view_trig_1.test | 6 - .../row_lock/t/ndb_row_lock_view_trig_2.test | 6 - 84 files changed, 1 insertion(+), 5366 deletions(-) delete mode 100644 mysql-test/suite/row_lock/include/row_lock.inc delete mode 100644 mysql-test/suite/row_lock/include/row_lock_big_tab.inc delete mode 100644 mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc delete mode 100644 mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc delete mode 100644 mysql-test/suite/row_lock/include/row_lock_trig.inc delete mode 100644 mysql-test/suite/row_lock/include/row_lock_view.inc delete mode 100644 mysql-test/suite/row_lock/include/row_lock_view_mix.inc delete mode 100644 mysql-test/suite/row_lock/include/row_lock_view_storedp.inc delete mode 100644 mysql-test/suite/row_lock/include/row_lock_view_trig.inc delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_1.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_2.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_3.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_4.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_5.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result delete mode 100644 mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_1.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_2.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_3.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_4.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_5.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result delete mode 100644 mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result delete mode 100644 mysql-test/suite/row_lock/readme.txt delete mode 100644 mysql-test/suite/row_lock/summary_of_sel_test.txt delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_1.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_2.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_3.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_4.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_5.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test delete mode 100644 mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_1.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_2.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_3.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_4.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_5.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test delete mode 100644 mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test diff --git a/Makefile.am b/Makefile.am index 186a3ec2453..66daff4bd68 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,6 +20,7 @@ AUTOMAKE_OPTIONS = foreign # These are built from source in the Docs directory EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \ README COPYING EXCEPTIONS-CLIENT CMakeLists.txt + SUBDIRS = . include @docs_dirs@ @zlib_dir@ @yassl_dir@ \ @readline_topdir@ sql-common scripts \ @thread_dirs@ pstack \ @@ -157,8 +158,6 @@ test-bt: @PERL@ ./mysql-test-run.pl --force --comment=funcs1_ps --ps-protocol --suite=funcs_1 -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2 - -cd mysql-test ; MTR_BUILD_THREAD=auto \ - @PERL@ ./mysql-test-run.pl --force --comment=rowlock --suite=row_lock -if [ -d mysql-test/suite/nist ] ; then \ cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --comment=NIST+normal --force --suite=nist ; \ diff --git a/mysql-test/suite/row_lock/include/row_lock.inc b/mysql-test/suite/row_lock/include/row_lock.inc deleted file mode 100644 index 8572bc0246e..00000000000 --- a/mysql-test/suite/row_lock/include/row_lock.inc +++ /dev/null @@ -1,83 +0,0 @@ ---disable_warnings -DROP TABLE IF EXISTS t1, t2; ---enable_warnings -SET autocommit=0; -# Create additional connections used through test -CONNECT (root1, localhost, root,,); -SET autocommit=0; ---echo connection default; -CONNECTION default; -eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -eval $indext1; -eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -eval $indext2; -COMMIT; -SELECT @@global.tx_isolation; - -# Both transaction are able to update the tables -eval EXPLAIN $select; -eval $select; - ---echo connection root1; -CONNECTION root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection root1; -CONNECTION root1; -UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection root1; -CONNECTION root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -COMMIT; - ---echo connection root1; -CONNECTION root1; -ROLLBACK; - ---echo connection default; -CONNECTION default; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection root1; -CONNECTION root1; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -DISCONNECT root1; ---echo connection default; -CONNECTION default; -DROP TABLE t1, t2; - diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab.inc deleted file mode 100644 index f0823067eac..00000000000 --- a/mysql-test/suite/row_lock/include/row_lock_big_tab.inc +++ /dev/null @@ -1,94 +0,0 @@ ---disable_warnings -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; ---enable_warnings -SET autocommit=0; -# Create additional connections used through test -CONNECT (root1, localhost, root,,); -SET autocommit=0; ---echo connection default; -CONNECTION default; -eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -eval $indext1; -eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -eval $indext2; -DELIMITER |; -CREATE PROCEDURE fill_t1 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO - INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); - SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t1() RETURNS int -BEGIN - DECLARE res int DEFAULT 0; - SELECT count(*)/2 INTO res FROM t1; - RETURN res; -END; -| -CREATE PROCEDURE fill_t2 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO - INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); - SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t2() RETURNS int -BEGIN - DECLARE res int DEFAULT 0; - SELECT count(*)/2 INTO res FROM t2; - RETURN res; -END; -| -DELIMITER ;| -CALL fill_t1 (10); -CALL fill_t2 (10); -COMMIT; -SELECT @@global.tx_isolation; -# With the two separate selects (without join) the differs from -# that select with join. - -# Both transaction are able to update the tables -eval EXPLAIN $select; -eval $select; - ---echo connection root1; -CONNECTION root1; -SELECT k from t1 WHERE k < half_t1(); -SELECT k from t1 WHERE k >= half_t1(); -UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -COMMIT; - ---echo connection root1; -CONNECTION root1; -ROLLBACK; - ---echo connection default; -CONNECTION default; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection root1; -CONNECTION root1; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -DISCONNECT root1; ---echo connection default; -CONNECTION default; -DROP VIEW IF EXISTS v1; -DROP TABLE t1, t2; -#DROP VIEW v1; - diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc deleted file mode 100644 index 8535c016819..00000000000 --- a/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc +++ /dev/null @@ -1,93 +0,0 @@ ---disable_warnings -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; ---enable_warnings -SET autocommit=0; -# Create additional connections used through test -CONNECT (root1, localhost, root,,); -SET autocommit=0; ---echo connection default; -CONNECTION default; -eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -eval $indext1; -eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -eval $indext2; -DELIMITER |; -CREATE PROCEDURE fill_t1 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO - INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); - SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t1() RETURNS int -BEGIN - DECLARE res int DEFAULT 0; - SELECT MOD(k,2) INTO res FROM t1; - RETURN res; -END; -| -CREATE PROCEDURE fill_t2 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO - INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); - SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t2() RETURNS int -BEGIN - DECLARE res int DEFAULT 0; - SELECT MOD(k,2) INTO res FROM t2; - RETURN res; -END; -| -DELIMITER ;| -eval CALL fill_t1 ($nbrows); -eval CALL fill_t2 ($nbrows); -COMMIT; -SELECT @@global.tx_isolation; -# With the two separate selects (without join) the differs from -# that select with join. - -# Both transaction are able to update the tables -eval EXPLAIN $select; -eval $select; - ---echo connection root1; -CONNECTION root1; -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE; -UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k; -SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k; -SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k; -SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k; -SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k; - -COMMIT; - ---echo connection root1; -CONNECTION root1; -ROLLBACK; - ---echo connection default; -CONNECTION default; -SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k; -SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k; - ---echo connection root1; -CONNECTION root1; -SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k; -SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k; -DISCONNECT root1; ---echo connection default; -CONNECTION default; -DROP TABLE t1, t2; - - diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc deleted file mode 100644 index 050f2a54016..00000000000 --- a/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc +++ /dev/null @@ -1,93 +0,0 @@ ---disable_warnings -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; ---enable_warnings -SET autocommit=0; -# Create additional connections used through test -CONNECT (root1, localhost, root,,); -SET autocommit=0; ---echo connection default; -CONNECTION default; -eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -eval $indext1; -eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -eval $indext2; -DELIMITER |; -CREATE PROCEDURE fill_t1 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO - INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); - SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t1() RETURNS int -BEGIN - DECLARE res int DEFAULT 0; - SELECT MOD(k,2) INTO res FROM t1; - RETURN res; -END; -| -CREATE PROCEDURE fill_t2 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO - INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); - SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t2() RETURNS int -BEGIN - DECLARE res int DEFAULT 0; - SELECT MOD(k,2) INTO res FROM t2; - RETURN res; -END; -| -DELIMITER ;| -eval CALL fill_t1 ($nbrows); -eval CALL fill_t2 ($nbrows); -COMMIT; -SELECT @@global.tx_isolation; -# With the two separate selects (without join) the differs from -# that select with join. - -# Both transaction are able to update the tables -eval EXPLAIN $select; -eval $select; - ---echo connection root1; -CONNECTION root1; -#SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k FOR UPDATE; -DELETE FROM t1 WHERE t1.k % 2 = 1; -SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k; -SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k; -SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k; -SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k; - -COMMIT; - ---echo connection root1; -CONNECTION root1; -ROLLBACK; - ---echo connection default; -CONNECTION default; -SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k; -SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k; - ---echo connection root1; -CONNECTION root1; -SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k; -SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k; -DISCONNECT root1; ---echo connection default; -CONNECTION default; -DROP TABLE t1, t2; - - diff --git a/mysql-test/suite/row_lock/include/row_lock_trig.inc b/mysql-test/suite/row_lock/include/row_lock_trig.inc deleted file mode 100644 index 384f00f243e..00000000000 --- a/mysql-test/suite/row_lock/include/row_lock_trig.inc +++ /dev/null @@ -1,96 +0,0 @@ ---disable_warnings -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; ---enable_warnings -SET autocommit=0; -# Create additional connections used through test -CONNECT (root1, localhost, root,,); -SET autocommit=0; ---echo connection default; -CONNECTION default; -eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -eval $indext1; -eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -eval $indext2; -DELIMITER |; - -CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 - FOR EACH ROW BEGIN - UPDATE t1 SET l = NEW.i WHERE i = OLD.i; - END; -| - -DELIMITER ;| - -COMMIT; -SELECT @@global.tx_isolation; -# With the two separate selects (without join) the differs from -# that select with join. - -# Both transaction are able to update the tables -eval EXPLAIN $select; -eval $select; ---echo connection root1; -CONNECTION root1; -UPDATE t2 SET t2.i=225 WHERE t2.i=125; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -UPDATE t2 SET t2.i=223 WHERE t2.i=123; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection root1; -CONNECTION root1; -UPDATE t2 SET t2.i=226 WHERE t2.i=126; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -UPDATE t2 SET t2.i=224 WHERE t2.i=124; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection root1; -CONNECTION root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -COMMIT; - ---echo connection root1; -CONNECTION root1; -ROLLBACK; - ---echo connection default; -CONNECTION default; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection root1; -CONNECTION root1; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -DISCONNECT root1; ---echo connection default; -CONNECTION default; -DROP TABLE t1, t2; -#DROP VIEW v1; - diff --git a/mysql-test/suite/row_lock/include/row_lock_view.inc b/mysql-test/suite/row_lock/include/row_lock_view.inc deleted file mode 100644 index fbed8f64d3a..00000000000 --- a/mysql-test/suite/row_lock/include/row_lock_view.inc +++ /dev/null @@ -1,89 +0,0 @@ ---disable_warnings -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; ---enable_warnings -SET autocommit=0; -# Create additional connections used through test -CONNECT (root1, localhost, root,,); -SET autocommit=0; ---echo connection default; -CONNECTION default; -eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -eval $indext1; -eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -eval $indext2; -CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; -COMMIT; -SELECT @@global.tx_isolation; -# With the two separate selects (without join) the differs from -# that select with join. - -# Both transaction are able to update the tables -eval EXPLAIN $select; -eval $select; - ---echo connection root1; -CONNECTION root1; -UPDATE v1 SET i=325 where i=125; -SELECT * FROM v1 ORDER BY i,l; -SELECT * FROM t1 ORDER BY t1.k; - ---echo connection default; -CONNECTION default; -UPDATE v1 SET i=323 where i=123; -SELECT * FROM v1 ORDER BY i,l; -SELECT * FROM t1 ORDER BY t1.k; - ---echo connection root1; -CONNECTION root1; -UPDATE v1 SET i=326 where i=126; -SELECT * FROM v1 ORDER BY i,l; -SELECT * FROM t1 ORDER BY t1.k; - ---echo connection default; -CONNECTION default; -UPDATE v1 SET i=324 where i=124; -SELECT * FROM v1 ORDER BY i,l; -SELECT * FROM t1 ORDER BY t1.k; - ---echo connection root1; -CONNECTION root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -COMMIT; - ---echo connection root1; -CONNECTION root1; -ROLLBACK; - ---echo connection default; -CONNECTION default; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection root1; -CONNECTION root1; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -DISCONNECT root1; ---echo connection default; -CONNECTION default; -DROP VIEW IF EXISTS v1; -DROP TABLE t1, t2; -#DROP VIEW v1; - diff --git a/mysql-test/suite/row_lock/include/row_lock_view_mix.inc b/mysql-test/suite/row_lock/include/row_lock_view_mix.inc deleted file mode 100644 index 9e8cf3d34fc..00000000000 --- a/mysql-test/suite/row_lock/include/row_lock_view_mix.inc +++ /dev/null @@ -1,92 +0,0 @@ ---disable_warnings -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; ---enable_warnings -SET autocommit=0; -# Create additional connections used through test -CONNECT (root1, localhost, root,,); -SET autocommit=0; ---echo connection default; -CONNECTION default; -eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -eval $indext1; -eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -eval $indext2; -CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; -COMMIT; -SELECT @@global.tx_isolation; -# With the two separate selects (without join) the differs from -# that select with join. - -# Both transaction are able to update the tables -eval EXPLAIN $select; -eval $select; - ---echo connection root1; -CONNECTION root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -#UPDATE v1 SET i=325 where i=125; -#SELECT * FROM v1 ORDER BY i,l; -#SELECT * FROM t1 ORDER BY t1.k; - ---echo connection default; -CONNECTION default; -UPDATE v1 SET i=323 where i=123; -SELECT * FROM v1 ORDER BY i,l; -SELECT * FROM t1 ORDER BY t1.k; - ---echo connection root1; -CONNECTION root1; -UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -UPDATE v1 SET i=324 where i=124; -SELECT * FROM v1 ORDER BY i,l; -SELECT * FROM t1 ORDER BY t1.k; - ---echo connection root1; -CONNECTION root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -COMMIT; - ---echo connection root1; -CONNECTION root1; -ROLLBACK; - ---echo connection default; -CONNECTION default; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection root1; -CONNECTION root1; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -DISCONNECT root1; ---echo connection default; -CONNECTION default; -DROP VIEW IF EXISTS v1; -DROP TABLE t1, t2; -#DROP VIEW v1; - diff --git a/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc b/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc deleted file mode 100644 index 479392098be..00000000000 --- a/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc +++ /dev/null @@ -1,126 +0,0 @@ ---disable_warnings -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -DROP PROCEDURE IF EXISTS stp_t; ---enable_warnings -SET autocommit=0; -# Create additional connections used through test -CONNECT (root1, localhost, root,,); -SET autocommit=0; -CONNECT (root2, localhost, root,,); -SET autocommit=0; ---echo connection default; -CONNECTION default; -eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -INSERT INTO t1 VALUES (5,127,5,127); -INSERT INTO t1 VALUES (6,128,6,128); -eval $indext1; -eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -INSERT INTO t2 VALUES (5,127,5,127); -INSERT INTO t2 VALUES (6,128,6,128); -eval $indext2; -CREATE VIEW v1 AS SELECT t1.i from t1; -DELIMITER |; - -CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA - BEGIN - UPDATE t2 SET i = p2 WHERE i = p1; - UPDATE v1 SET i = p2 WHERE i = p1; - SELECT * FROM v1 ORDER BY i; - SELECT * FROM t1 ORDER BY t1.k; - SELECT * FROM t2 ORDER BY t2.k; - END; -| - -DELIMITER ;| - -COMMIT; -SELECT @@global.tx_isolation; -eval EXPLAIN $select; -eval $select; ---echo connection root1; -CONNECTION root1; -CALL stp_t (125, 225); - ---echo connection root2; -CONNECTION root2; -CALL stp_t (127, 227); - ---echo connection default; -CONNECTION default; -CALL stp_t (123, 223); - ---echo connection root1; -CONNECTION root1; -CALL stp_t (126, 226); - ---echo connection root2; -CONNECTION root2; -CALL stp_t (128, 228); - ---echo connection default; -CONNECTION default; -CALL stp_t (124, 224); - ---echo connection root1; -CONNECTION root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection root2; -CONNECTION root2; -DELETE FROM t1 WHERE t1.i=228; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -COMMIT; - ---echo connection root1; -CONNECTION root1; -ROLLBACK; - ---echo connection root1; -CONNECTION root1; -COMMIT; - ---echo connection default; -CONNECTION default; -SELECT * FROM v1 ORDER BY i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection root1; -CONNECTION root1; -SELECT * FROM v1 ORDER BY i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -DISCONNECT root1; - ---echo connection root2; -CONNECTION root2; -SELECT * FROM v1 ORDER BY i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -DISCONNECT root2; - ---echo connection default; -CONNECTION default; ---disable_warnings -DROP VIEW v1; -DROP PROCEDURE stp_t; -DROP TABLE t1, t2; ---enable_warnings diff --git a/mysql-test/suite/row_lock/include/row_lock_view_trig.inc b/mysql-test/suite/row_lock/include/row_lock_view_trig.inc deleted file mode 100644 index 785eb1b66a9..00000000000 --- a/mysql-test/suite/row_lock/include/row_lock_view_trig.inc +++ /dev/null @@ -1,99 +0,0 @@ ---disable_warnings -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; ---enable_warnings -SET autocommit=0; -# Create additional connections used through test -CONNECT (root1, localhost, root,,); -SET autocommit=0; ---echo connection default; -CONNECTION default; -eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -eval $indext1; -eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -eval $indext2; -CREATE VIEW v1 AS SELECT t1.i from t1; -DELIMITER |; - -CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 - FOR EACH ROW BEGIN - UPDATE v1 SET i = NEW.i WHERE i = OLD.i; - END; -| - -DELIMITER ;| - -COMMIT; -SELECT @@global.tx_isolation; -eval EXPLAIN $select; -eval $select; ---echo connection root1; -CONNECTION root1; -UPDATE t2 SET t2.i=225 WHERE t2.i=125; -SELECT * FROM v1 ORDER BY i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -UPDATE t2 SET t2.i=223 WHERE t2.i=123; -SELECT * FROM v1 ORDER BY i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection root1; -CONNECTION root1; -UPDATE t2 SET t2.i=226 WHERE t2.i=126; -SELECT * FROM v1 ORDER BY i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -UPDATE t2 SET t2.i=224 WHERE t2.i=124; -SELECT * FROM v1 ORDER BY i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection root1; -CONNECTION root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection default; -CONNECTION default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -COMMIT; - ---echo connection root1; -CONNECTION root1; -ROLLBACK; - ---echo connection default; -CONNECTION default; -SELECT * FROM v1 ORDER BY i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; - ---echo connection root1; -CONNECTION root1; -SELECT * FROM v1 ORDER BY i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -DISCONNECT root1; ---echo connection default; -CONNECTION default; -DROP TABLE t1, t2; -DROP VIEW v1; - diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_1.result deleted file mode 100644 index 54ed4350ba9..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_1.result +++ /dev/null @@ -1,142 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index -1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -i i -123 123 -124 124 -connection root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -connection default; -UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -COMMIT; -connection root1; -ROLLBACK; -connection default; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection default; -DROP TABLE t1, t2; -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_2.result deleted file mode 100644 index 56154e64489..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_2.result +++ /dev/null @@ -1,32 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t2 (i); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -i i -123 123 -124 124 -connection root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_3.result b/mysql-test/suite/row_lock/r/innodb_row_lock_3.result deleted file mode 100644 index a89c55973d2..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_3.result +++ /dev/null @@ -1,32 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t2 (i); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -i i -123 123 -124 124 -connection root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_4.result b/mysql-test/suite/row_lock/r/innodb_row_lock_4.result deleted file mode 100644 index 310d24a456a..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_4.result +++ /dev/null @@ -1,142 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index -1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -i i -123 123 -124 124 -connection root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -connection default; -UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -COMMIT; -connection root1; -ROLLBACK; -connection default; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection default; -DROP TABLE t1, t2; -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_5.result b/mysql-test/suite/row_lock/r/innodb_row_lock_5.result deleted file mode 100644 index ace5fddfad5..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_5.result +++ /dev/null @@ -1,32 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where -SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -i i -123 123 -124 124 -connection root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result deleted file mode 100644 index 8f00c3a0bb7..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result +++ /dev/null @@ -1,97 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -CREATE INDEX ixi ON t2 (i); -CREATE PROCEDURE fill_t1 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO -INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); -SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t1() RETURNS int -BEGIN -DECLARE res int DEFAULT 0; -SELECT count(*)/2 INTO res FROM t1; -RETURN res; -END; -| -CREATE PROCEDURE fill_t2 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO -INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); -SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t2() RETURNS int -BEGIN -DECLARE res int DEFAULT 0; -SELECT count(*)/2 INTO res FROM t2; -RETURN res; -END; -| -CALL fill_t1 (10); -CALL fill_t2 (10); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ixi ixi 5 NULL 10 Using where; Using index -1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where; Using index -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE; -i i -connection root1; -SELECT k from t1 WHERE k < half_t1(); -k -0 -1 -2 -3 -4 -SELECT k from t1 WHERE k >= half_t1(); -k -5 -6 -7 -8 -9 -UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -0 1111 0 100 -1 1111 1 101 -2 1111 2 102 -3 1111 3 103 -4 1111 4 104 -5 105 5 105 -6 106 6 106 -7 107 7 107 -8 108 8 108 -9 109 9 109 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -0 2222 0 100 -1 2222 1 101 -2 2222 2 102 -3 2222 3 103 -4 2222 4 104 -5 105 5 105 -6 106 6 106 -7 107 7 107 -8 108 8 108 -9 109 9 109 -connection default; -UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result deleted file mode 100644 index 0b12f149193..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result +++ /dev/null @@ -1,145 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -CREATE INDEX ixi ON t2 (i); -CREATE PROCEDURE fill_t1 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO -INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); -SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t1() RETURNS int -BEGIN -DECLARE res int DEFAULT 0; -SELECT MOD(k,2) INTO res FROM t1; -RETURN res; -END; -| -CREATE PROCEDURE fill_t2 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO -INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); -SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t2() RETURNS int -BEGIN -DECLARE res int DEFAULT 0; -SELECT MOD(k,2) INTO res FROM t2; -RETURN res; -END; -| -CALL fill_t1 (40); -CALL fill_t2 (40); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1 -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE; -i i -100 100 -102 102 -104 104 -106 106 -108 108 -110 110 -112 112 -114 114 -116 116 -118 118 -120 120 -122 122 -124 124 -126 126 -128 128 -130 130 -132 132 -134 134 -136 136 -138 138 -connection root1; -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE; -i i -101 101 -103 103 -105 105 -107 107 -109 109 -111 111 -113 113 -115 115 -117 117 -119 119 -121 121 -123 123 -125 125 -127 127 -129 129 -131 131 -133 133 -135 135 -137 137 -139 139 -UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k; -SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k; -k i j l -0 100 0 100 -1 1111 1 101 -2 102 2 102 -3 1111 3 103 -4 104 4 104 -5 1111 5 105 -6 106 6 106 -7 1111 7 107 -8 108 8 108 -9 1111 9 109 -10 110 10 110 -11 1111 11 111 -12 112 12 112 -13 1111 13 113 -14 114 14 114 -15 1111 15 115 -16 116 16 116 -17 1111 17 117 -18 118 18 118 -19 1111 19 119 -SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k; -k i j l -0 100 0 100 -1 2222 1 101 -2 102 2 102 -3 2222 3 103 -4 104 4 104 -5 2222 5 105 -6 106 6 106 -7 2222 7 107 -8 108 8 108 -9 2222 9 109 -10 110 10 110 -11 2222 11 111 -12 112 12 112 -13 2222 13 113 -14 114 14 114 -15 2222 15 115 -16 116 16 116 -17 2222 17 117 -18 118 18 118 -19 2222 19 119 -connection default; -UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result deleted file mode 100644 index cc9f297f9fb..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result +++ /dev/null @@ -1,113 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -CREATE INDEX ixi ON t2 (i); -CREATE PROCEDURE fill_t1 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO -INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); -SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t1() RETURNS int -BEGIN -DECLARE res int DEFAULT 0; -SELECT MOD(k,2) INTO res FROM t1; -RETURN res; -END; -| -CREATE PROCEDURE fill_t2 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO -INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); -SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t2() RETURNS int -BEGIN -DECLARE res int DEFAULT 0; -SELECT MOD(k,2) INTO res FROM t2; -RETURN res; -END; -| -CALL fill_t1 (40); -CALL fill_t2 (40); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1 -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE; -i i -100 100 -102 102 -104 104 -106 106 -108 108 -110 110 -112 112 -114 114 -116 116 -118 118 -120 120 -122 122 -124 124 -126 126 -128 128 -130 130 -132 132 -134 134 -136 136 -138 138 -connection root1; -DELETE FROM t1 WHERE t1.k % 2 = 1; -SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k; -k i j l -0 100 0 100 -2 102 2 102 -4 104 4 104 -6 106 6 106 -8 108 8 108 -10 110 10 110 -12 112 12 112 -14 114 14 114 -16 116 16 116 -18 118 18 118 -SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k; -k i j l -0 100 0 100 -1 101 1 101 -2 102 2 102 -3 103 3 103 -4 104 4 104 -5 105 5 105 -6 106 6 106 -7 107 7 107 -8 108 8 108 -9 109 9 109 -10 110 10 110 -11 111 11 111 -12 112 12 112 -13 113 13 113 -14 114 14 114 -15 115 15 115 -16 116 16 116 -17 117 17 117 -18 118 18 118 -19 119 19 119 -connection default; -UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result deleted file mode 100644 index dd43e5752e5..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result +++ /dev/null @@ -1,151 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 -FOR EACH ROW BEGIN -UPDATE t1 SET l = NEW.i WHERE i = OLD.i; -END; -| -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index -SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -i -123 -124 -connection root1; -UPDATE t2 SET t2.i=225 WHERE t2.i=125; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 225 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -connection default; -UPDATE t2 SET t2.i=223 WHERE t2.i=123; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 223 -2 124 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -UPDATE t2 SET t2.i=226 WHERE t2.i=126; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 225 -4 126 4 226 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -UPDATE t2 SET t2.i=224 WHERE t2.i=124; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 223 -2 124 2 224 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 225 -4 126 4 226 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 223 -2 124 2 224 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -COMMIT; -connection root1; -ROLLBACK; -connection default; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 223 -2 124 2 224 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 223 -2 124 2 224 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection default; -DROP TABLE t1, t2; -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result deleted file mode 100644 index cb3a5c692e9..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result +++ /dev/null @@ -1,37 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t2 (i); -CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 -FOR EACH ROW BEGIN -UPDATE t1 SET l = NEW.i WHERE i = OLD.i; -END; -| -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where -SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -i -123 -124 -connection root1; -UPDATE t2 SET t2.i=225 WHERE t2.i=125; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result deleted file mode 100644 index 834cb669833..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result +++ /dev/null @@ -1,34 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index -1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -i i -123 123 -124 124 -connection root1; -UPDATE v1 SET i=325 where i=125; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result deleted file mode 100644 index 440138d4cd1..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result +++ /dev/null @@ -1,40 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index -1 SIMPLE t2 index NULL PRIMARY 4 NULL 4 Using index -SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; -i -123 -124 -123 -124 -123 -124 -123 -124 -connection root1; -UPDATE v1 SET i=325 where i=125; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result deleted file mode 100644 index 230873b67a0..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result +++ /dev/null @@ -1,48 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index -1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -i i -123 123 -124 124 -connection root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -connection default; -UPDATE v1 SET i=323 where i=123; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result deleted file mode 100644 index d792d573f8e..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result +++ /dev/null @@ -1,40 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index -1 SIMPLE t2 index NULL PRIMARY 4 NULL 4 Using index -SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; -i -123 -124 -123 -124 -123 -124 -123 -124 -connection root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result deleted file mode 100644 index 77b9a4dd964..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result +++ /dev/null @@ -1,312 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -INSERT INTO t1 VALUES (5,127,5,127); -INSERT INTO t1 VALUES (6,128,6,128); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -INSERT INTO t2 VALUES (5,127,5,127); -INSERT INTO t2 VALUES (6,128,6,128); -CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i from t1; -CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA -BEGIN -UPDATE t2 SET i = p2 WHERE i = p1; -UPDATE v1 SET i = p2 WHERE i = p1; -SELECT * FROM v1 ORDER BY i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -END; -| -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ixi ixi 5 NULL 6 Using where; Using index -SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -i -123 -124 -connection root1; -CALL stp_t (125, 225); -i -123 -124 -126 -127 -128 -225 -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -connection root2; -CALL stp_t (127, 227); -i -123 -124 -125 -126 -128 -227 -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 227 5 127 -6 128 6 128 -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 227 5 127 -6 128 6 128 -connection default; -CALL stp_t (123, 223); -i -124 -125 -126 -127 -128 -223 -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -connection root1; -CALL stp_t (126, 226); -i -123 -124 -127 -128 -225 -226 -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -5 127 5 127 -6 128 6 128 -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -5 127 5 127 -6 128 6 128 -connection root2; -CALL stp_t (128, 228); -i -123 -124 -125 -126 -227 -228 -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 227 5 127 -6 228 6 128 -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 227 5 127 -6 228 6 128 -connection default; -CALL stp_t (124, 224); -i -125 -126 -127 -128 -223 -224 -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -connection root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -5 127 5 127 -6 128 6 128 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -5 127 5 127 -6 128 6 128 -connection root2; -DELETE FROM t1 WHERE t1.i=228; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 227 5 127 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 227 5 127 -6 228 6 128 -connection default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -COMMIT; -connection root1; -ROLLBACK; -connection root1; -COMMIT; -connection default; -SELECT * FROM v1 ORDER BY i; -i -125 -126 -127 -128 -223 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -connection root1; -SELECT * FROM v1 ORDER BY i; -i -125 -126 -127 -128 -223 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -connection root2; -SELECT * FROM v1 ORDER BY i; -i -123 -124 -125 -126 -227 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 227 5 127 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 227 5 127 -6 228 6 128 -connection default; -DROP TABLE t1, t2; -DROP VIEW v1; -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result deleted file mode 100644 index 73d8a3f4bea..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result +++ /dev/null @@ -1,47 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -INSERT INTO t1 VALUES (5,127,5,127); -INSERT INTO t1 VALUES (6,128,6,128); -#CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -INSERT INTO t2 VALUES (5,127,5,127); -INSERT INTO t2 VALUES (6,128,6,128); -#CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i from t1; -CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA -BEGIN -UPDATE t2 SET i = p2 WHERE i = p1; -UPDATE v1 SET i = p2 WHERE i = p1; -SELECT * FROM v1 ORDER BY i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -END; -| -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where -SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -i -123 -124 -connection root1; -CALL stp_t (125, 225); diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result deleted file mode 100644 index 90383a9489f..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result +++ /dev/null @@ -1,183 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i from t1; -CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 -FOR EACH ROW BEGIN -UPDATE v1 SET i = NEW.i WHERE i = OLD.i; -END; -| -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index -SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -i -123 -124 -connection root1; -UPDATE t2 SET t2.i=225 WHERE t2.i=125; -SELECT * FROM v1 ORDER BY i; -i -123 -124 -126 -225 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -connection default; -UPDATE t2 SET t2.i=223 WHERE t2.i=123; -SELECT * FROM v1 ORDER BY i; -i -124 -125 -126 -223 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -UPDATE t2 SET t2.i=226 WHERE t2.i=126; -SELECT * FROM v1 ORDER BY i; -i -123 -124 -225 -226 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -UPDATE t2 SET t2.i=224 WHERE t2.i=124; -SELECT * FROM v1 ORDER BY i; -i -125 -126 -223 -224 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -COMMIT; -connection root1; -ROLLBACK; -connection default; -SELECT * FROM v1 ORDER BY i; -i -125 -126 -223 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -SELECT * FROM v1 ORDER BY i; -i -125 -126 -223 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection default; -DROP TABLE t1, t2; -DROP VIEW v1; -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result deleted file mode 100644 index 55793558b21..00000000000 --- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result +++ /dev/null @@ -1,38 +0,0 @@ -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i from t1; -CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 -FOR EACH ROW BEGIN -UPDATE v1 SET i = NEW.i WHERE i = OLD.i; -END; -| -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where -SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -i -123 -124 -connection root1; -UPDATE t2 SET t2.i=225 WHERE t2.i=125; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_1.result deleted file mode 100644 index 248c7d5ea1f..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_1.result +++ /dev/null @@ -1,139 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where -1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -i i -123 123 -124 124 -connection root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -connection default; -UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -COMMIT; -connection root1; -ROLLBACK; -connection default; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection default; -DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_2.result deleted file mode 100644 index 109d99dd036..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_2.result +++ /dev/null @@ -1,31 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t2 (i); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -i i -123 123 -124 124 -connection root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_3.result b/mysql-test/suite/row_lock/r/ndb_row_lock_3.result deleted file mode 100644 index c936ea209ff..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_3.result +++ /dev/null @@ -1,30 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t2 (i); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -i i -123 123 -124 124 -connection root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_4.result b/mysql-test/suite/row_lock/r/ndb_row_lock_4.result deleted file mode 100644 index 875c783bd81..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_4.result +++ /dev/null @@ -1,139 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where -1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -i i -123 123 -124 124 -connection root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -connection default; -UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -COMMIT; -connection root1; -ROLLBACK; -connection default; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection default; -DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_5.result b/mysql-test/suite/row_lock/r/ndb_row_lock_5.result deleted file mode 100644 index 0d94f8abf72..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_5.result +++ /dev/null @@ -1,30 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where -SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -i i -123 123 -124 124 -connection root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result deleted file mode 100644 index 94b67c63d94..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result +++ /dev/null @@ -1,177 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -CREATE INDEX ixi ON t2 (i); -CREATE PROCEDURE fill_t1 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO -INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); -SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t1() RETURNS int -BEGIN -DECLARE res int DEFAULT 0; -SELECT count(*)/2 INTO res FROM t1; -RETURN res; -END; -| -CREATE PROCEDURE fill_t2 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO -INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); -SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t2() RETURNS int -BEGIN -DECLARE res int DEFAULT 0; -SELECT count(*)/2 INTO res FROM t2; -RETURN res; -END; -| -CALL fill_t1 (10); -CALL fill_t2 (10); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where -1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE; -i i -connection root1; -SELECT k from t1 WHERE k < half_t1(); -k -0 -3 -1 -2 -4 -SELECT k from t1 WHERE k >= half_t1(); -k -6 -7 -9 -5 -8 -UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -0 1111 0 100 -1 1111 1 101 -2 1111 2 102 -3 1111 3 103 -4 1111 4 104 -5 105 5 105 -6 106 6 106 -7 107 7 107 -8 108 8 108 -9 109 9 109 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -0 2222 0 100 -1 2222 1 101 -2 2222 2 102 -3 2222 3 103 -4 2222 4 104 -5 105 5 105 -6 106 6 106 -7 107 7 107 -8 108 8 108 -9 109 9 109 -connection default; -UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -0 100 0 100 -1 101 1 101 -2 102 2 102 -3 103 3 103 -4 104 4 104 -5 3333 5 105 -6 3333 6 106 -7 3333 7 107 -8 3333 8 108 -9 3333 9 109 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -0 100 0 100 -1 101 1 101 -2 102 2 102 -3 103 3 103 -4 104 4 104 -5 4444 5 105 -6 4444 6 106 -7 4444 7 107 -8 4444 8 108 -9 4444 9 109 -COMMIT; -connection root1; -ROLLBACK; -connection default; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -0 100 0 100 -1 101 1 101 -2 102 2 102 -3 103 3 103 -4 104 4 104 -5 3333 5 105 -6 3333 6 106 -7 3333 7 107 -8 3333 8 108 -9 3333 9 109 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -0 100 0 100 -1 101 1 101 -2 102 2 102 -3 103 3 103 -4 104 4 104 -5 4444 5 105 -6 4444 6 106 -7 4444 7 107 -8 4444 8 108 -9 4444 9 109 -connection root1; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -0 100 0 100 -1 101 1 101 -2 102 2 102 -3 103 3 103 -4 104 4 104 -5 3333 5 105 -6 3333 6 106 -7 3333 7 107 -8 3333 8 108 -9 3333 9 109 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -0 100 0 100 -1 101 1 101 -2 102 2 102 -3 103 3 103 -4 104 4 104 -5 4444 5 105 -6 4444 6 106 -7 4444 7 107 -8 4444 8 108 -9 4444 9 109 -connection default; -DROP VIEW IF EXISTS v1; -Warnings: -Note 1051 Unknown table 'test.v1' -DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result deleted file mode 100644 index 9803895e1a7..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result +++ /dev/null @@ -1,357 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -CREATE INDEX ixi ON t2 (i); -CREATE PROCEDURE fill_t1 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO -INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); -SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t1() RETURNS int -BEGIN -DECLARE res int DEFAULT 0; -SELECT MOD(k,2) INTO res FROM t1; -RETURN res; -END; -| -CREATE PROCEDURE fill_t2 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO -INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); -SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t2() RETURNS int -BEGIN -DECLARE res int DEFAULT 0; -SELECT MOD(k,2) INTO res FROM t2; -RETURN res; -END; -| -CALL fill_t1 (200); -CALL fill_t2 (200); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 200 Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1 -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE; -i i -135 135 -119 119 -211 211 -184 184 -232 232 -105 105 -188 188 -216 216 -255 255 -154 154 -197 197 -279 279 -218 218 -127 127 -203 203 -281 281 -194 194 -161 161 -276 276 -122 122 -139 139 -183 183 -114 114 -247 247 -144 144 -148 148 -174 174 -267 267 -142 142 -168 168 -226 226 -258 258 -231 231 -146 146 -253 253 -189 189 -230 230 -290 290 -178 178 -158 158 -130 130 -214 214 -133 133 -229 229 -294 294 -295 295 -108 108 -112 112 -297 297 -151 151 -251 251 -270 270 -291 291 -159 159 -132 132 -121 121 -244 244 -272 272 -293 293 -186 186 -111 111 -166 166 -201 201 -175 175 -180 180 -209 209 -192 192 -246 246 -195 195 -107 107 -233 233 -239 239 -103 103 -109 109 -128 128 -266 266 -143 143 -160 160 -187 187 -243 243 -273 273 -259 259 -110 110 -176 176 -141 141 -170 170 -215 215 -191 191 -200 200 -271 271 -162 162 -260 260 -106 106 -150 150 -126 126 -147 147 -155 155 -193 193 -207 207 -287 287 -235 235 -252 252 -129 129 -205 205 -268 268 -278 278 -116 116 -137 137 -199 199 -217 217 -234 234 -190 190 -236 236 -257 257 -100 100 -210 210 -212 212 -264 264 -221 221 -241 241 -256 256 -262 262 -265 265 -269 269 -277 277 -173 173 -177 177 -208 208 -219 219 -285 285 -101 101 -164 164 -113 113 -125 125 -202 202 -140 140 -156 156 -282 282 -181 181 -206 206 -299 299 -102 102 -145 145 -227 227 -196 196 -138 138 -198 198 -204 204 -237 237 -171 171 -284 284 -263 263 -292 292 -104 104 -149 149 -250 250 -296 296 -228 228 -280 280 -242 242 -248 248 -185 185 -220 220 -245 245 -275 275 -118 118 -120 120 -152 152 -153 153 -157 157 -182 182 -179 179 -254 254 -288 288 -172 172 -283 283 -286 286 -115 115 -238 238 -289 289 -131 131 -223 223 -134 134 -136 136 -222 222 -225 225 -261 261 -274 274 -123 123 -163 163 -224 224 -117 117 -298 298 -169 169 -124 124 -167 167 -240 240 -249 249 -165 165 -213 213 -connection root1; -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE; -i i -209 209 -195 195 -107 107 -233 233 -239 239 -103 103 -109 109 -143 143 -187 187 -243 243 -273 273 -259 259 -141 141 -215 215 -191 191 -271 271 -147 147 -155 155 -193 193 -207 207 -287 287 -235 235 -129 129 -205 205 -137 137 -199 199 -217 217 -257 257 -221 221 -241 241 -265 265 -269 269 -277 277 -173 173 -177 177 -135 135 -119 119 -211 211 -105 105 -255 255 -197 197 -279 279 -127 127 -203 203 -281 281 -161 161 -139 139 -183 183 -247 247 -267 267 -231 231 -253 253 -189 189 -133 133 -229 229 -295 295 -297 297 -151 151 -251 251 -291 291 -159 159 -121 121 -293 293 -111 111 -201 201 -175 175 -185 185 -245 245 -275 275 -153 153 -157 157 -179 179 -283 283 -115 115 -289 289 -131 131 -223 223 -225 225 -261 261 -123 123 -163 163 -117 117 -169 169 -167 167 -249 249 -165 165 -213 213 -219 219 -285 285 -101 101 -113 113 -125 125 -181 181 -299 299 -145 145 -227 227 -237 237 -171 171 -263 263 -149 149 -UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result deleted file mode 100644 index adb89b03480..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result +++ /dev/null @@ -1,255 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -CREATE INDEX ixi ON t2 (i); -CREATE PROCEDURE fill_t1 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO -INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100); -SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t1() RETURNS int -BEGIN -DECLARE res int DEFAULT 0; -SELECT MOD(k,2) INTO res FROM t1; -RETURN res; -END; -| -CREATE PROCEDURE fill_t2 (IN upb int) -BEGIN -DECLARE cnt int DEFAULT 0; -WHILE cnt < upb DO -INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100); -SET cnt= cnt+1; -END WHILE; -END; -| -CREATE FUNCTION half_t2() RETURNS int -BEGIN -DECLARE res int DEFAULT 0; -SELECT MOD(k,2) INTO res FROM t2; -RETURN res; -END; -| -CALL fill_t1 (200); -CALL fill_t2 (200); -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 200 Using where -1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1 -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE; -i i -135 135 -119 119 -211 211 -184 184 -232 232 -105 105 -188 188 -216 216 -255 255 -154 154 -197 197 -279 279 -218 218 -127 127 -203 203 -281 281 -194 194 -161 161 -276 276 -122 122 -139 139 -183 183 -114 114 -247 247 -144 144 -148 148 -174 174 -267 267 -142 142 -168 168 -226 226 -258 258 -231 231 -146 146 -253 253 -189 189 -230 230 -290 290 -178 178 -158 158 -130 130 -214 214 -133 133 -229 229 -294 294 -295 295 -108 108 -112 112 -297 297 -151 151 -251 251 -270 270 -291 291 -159 159 -132 132 -121 121 -244 244 -272 272 -293 293 -186 186 -111 111 -166 166 -201 201 -175 175 -180 180 -209 209 -192 192 -246 246 -195 195 -107 107 -233 233 -239 239 -103 103 -109 109 -128 128 -266 266 -143 143 -160 160 -187 187 -243 243 -273 273 -259 259 -110 110 -176 176 -141 141 -170 170 -215 215 -191 191 -200 200 -271 271 -162 162 -260 260 -106 106 -150 150 -126 126 -147 147 -155 155 -193 193 -207 207 -287 287 -235 235 -252 252 -129 129 -205 205 -268 268 -278 278 -116 116 -137 137 -199 199 -217 217 -234 234 -190 190 -236 236 -257 257 -100 100 -210 210 -212 212 -264 264 -221 221 -241 241 -256 256 -262 262 -265 265 -269 269 -277 277 -173 173 -177 177 -208 208 -219 219 -285 285 -101 101 -164 164 -113 113 -125 125 -202 202 -140 140 -156 156 -282 282 -181 181 -206 206 -299 299 -102 102 -145 145 -227 227 -196 196 -138 138 -198 198 -204 204 -237 237 -171 171 -284 284 -263 263 -292 292 -104 104 -149 149 -250 250 -296 296 -228 228 -280 280 -242 242 -248 248 -185 185 -220 220 -245 245 -275 275 -118 118 -120 120 -152 152 -153 153 -157 157 -182 182 -179 179 -254 254 -288 288 -172 172 -283 283 -286 286 -115 115 -238 238 -289 289 -131 131 -223 223 -134 134 -136 136 -222 222 -225 225 -261 261 -274 274 -123 123 -163 163 -224 224 -117 117 -298 298 -169 169 -124 124 -167 167 -240 240 -249 249 -165 165 -213 213 -connection root1; -DELETE FROM t1 WHERE t1.k % 2 = 1; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result deleted file mode 100644 index eb69fd2e306..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result +++ /dev/null @@ -1,148 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 -FOR EACH ROW BEGIN -UPDATE t1 SET l = NEW.i WHERE i = OLD.i; -END; -| -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where -SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -i -123 -124 -connection root1; -UPDATE t2 SET t2.i=225 WHERE t2.i=125; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 225 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -connection default; -UPDATE t2 SET t2.i=223 WHERE t2.i=123; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 223 -2 124 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -UPDATE t2 SET t2.i=226 WHERE t2.i=126; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 225 -4 126 4 226 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -UPDATE t2 SET t2.i=224 WHERE t2.i=124; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 223 -2 124 2 224 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 225 -4 126 4 226 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 223 -2 124 2 224 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -COMMIT; -connection root1; -ROLLBACK; -connection default; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 223 -2 124 2 224 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 223 -2 124 2 224 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection default; -DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result deleted file mode 100644 index bedb75da93a..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result +++ /dev/null @@ -1,35 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t2 (i); -CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 -FOR EACH ROW BEGIN -UPDATE t1 SET l = NEW.i WHERE i = OLD.i; -END; -| -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where -SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -i -123 -124 -connection root1; -UPDATE t2 SET t2.i=225 WHERE t2.i=125; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result deleted file mode 100644 index 279f2626c73..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result +++ /dev/null @@ -1,194 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where -1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -i i -123 123 -124 124 -connection root1; -UPDATE v1 SET i=325 where i=125; -SELECT * FROM v1 ORDER BY i,l; -i l -123 123 -123 124 -123 125 -123 126 -124 123 -124 124 -124 125 -124 126 -126 123 -126 124 -126 125 -126 126 -325 123 -325 124 -325 125 -325 126 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 325 3 125 -4 126 4 126 -connection default; -UPDATE v1 SET i=323 where i=123; -SELECT * FROM v1 ORDER BY i,l; -i l -124 123 -124 124 -124 125 -124 126 -125 123 -125 124 -125 125 -125 126 -126 123 -126 124 -126 125 -126 126 -323 123 -323 124 -323 125 -323 126 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 323 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -UPDATE v1 SET i=326 where i=126; -SELECT * FROM v1 ORDER BY i,l; -i l -123 123 -123 124 -123 125 -123 126 -124 123 -124 124 -124 125 -124 126 -325 123 -325 124 -325 125 -325 126 -326 123 -326 124 -326 125 -326 126 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 325 3 125 -4 326 4 126 -connection default; -UPDATE v1 SET i=324 where i=124; -SELECT * FROM v1 ORDER BY i,l; -i l -125 123 -125 124 -125 125 -125 126 -126 123 -126 124 -126 125 -126 126 -323 123 -323 124 -323 125 -323 126 -324 123 -324 124 -324 125 -324 126 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 323 1 123 -2 324 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 325 3 125 -4 326 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 323 1 123 -2 324 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -COMMIT; -connection root1; -ROLLBACK; -connection default; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 323 1 123 -2 324 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 323 1 123 -2 324 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection default; -DROP VIEW IF EXISTS v1; -DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result deleted file mode 100644 index 9e74e93b0cc..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result +++ /dev/null @@ -1,200 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 -SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; -i -123 -124 -123 -124 -123 -124 -123 -124 -connection root1; -UPDATE v1 SET i=325 where i=125; -SELECT * FROM v1 ORDER BY i,l; -i l -123 123 -123 124 -123 125 -123 126 -124 123 -124 124 -124 125 -124 126 -126 123 -126 124 -126 125 -126 126 -325 123 -325 124 -325 125 -325 126 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 325 3 125 -4 126 4 126 -connection default; -UPDATE v1 SET i=323 where i=123; -SELECT * FROM v1 ORDER BY i,l; -i l -124 123 -124 124 -124 125 -124 126 -125 123 -125 124 -125 125 -125 126 -126 123 -126 124 -126 125 -126 126 -323 123 -323 124 -323 125 -323 126 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 323 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -UPDATE v1 SET i=326 where i=126; -SELECT * FROM v1 ORDER BY i,l; -i l -123 123 -123 124 -123 125 -123 126 -124 123 -124 124 -124 125 -124 126 -325 123 -325 124 -325 125 -325 126 -326 123 -326 124 -326 125 -326 126 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 325 3 125 -4 326 4 126 -connection default; -UPDATE v1 SET i=324 where i=124; -SELECT * FROM v1 ORDER BY i,l; -i l -125 123 -125 124 -125 125 -125 126 -126 123 -126 124 -126 125 -126 126 -323 123 -323 124 -323 125 -323 126 -324 123 -324 124 -324 125 -324 126 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 323 1 123 -2 324 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 325 3 125 -4 326 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 323 1 123 -2 324 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -COMMIT; -connection root1; -ROLLBACK; -connection default; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 323 1 123 -2 324 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 323 1 123 -2 324 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection default; -DROP VIEW IF EXISTS v1; -DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result deleted file mode 100644 index b5b1c519702..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result +++ /dev/null @@ -1,169 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where -1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where -SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -i i -123 123 -124 124 -connection root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -connection default; -UPDATE v1 SET i=323 where i=123; -SELECT * FROM v1 ORDER BY i,l; -i l -124 123 -124 124 -124 125 -124 126 -125 123 -125 124 -125 125 -125 126 -126 123 -126 124 -126 125 -126 126 -323 123 -323 124 -323 125 -323 126 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 323 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -UPDATE v1 SET i=324 where i=124; -SELECT * FROM v1 ORDER BY i,l; -i l -125 123 -125 124 -125 125 -125 126 -126 123 -126 124 -126 125 -126 126 -323 123 -323 124 -323 125 -323 126 -324 123 -324 124 -324 125 -324 126 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 323 1 123 -2 324 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 323 1 123 -2 324 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -COMMIT; -connection root1; -ROLLBACK; -connection default; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 323 1 123 -2 324 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 323 1 123 -2 324 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection default; -DROP VIEW IF EXISTS v1; -DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result deleted file mode 100644 index d92f9ad9664..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result +++ /dev/null @@ -1,38 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2; -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 4 -SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; -i -123 -124 -123 -124 -123 -124 -123 -124 -connection root1; -UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result deleted file mode 100644 index e2a2a6e7deb..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result +++ /dev/null @@ -1,309 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -DROP PROCEDURE IF EXISTS stp_t; -SET autocommit=0; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -INSERT INTO t1 VALUES (5,127,5,127); -INSERT INTO t1 VALUES (6,128,6,128); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -INSERT INTO t2 VALUES (5,127,5,127); -INSERT INTO t2 VALUES (6,128,6,128); -CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i from t1; -CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA -BEGIN -UPDATE t2 SET i = p2 WHERE i = p1; -UPDATE v1 SET i = p2 WHERE i = p1; -SELECT * FROM v1 ORDER BY i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -END; -| -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where -SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -i -123 -124 -connection root1; -CALL stp_t (125, 225); -i -123 -124 -126 -127 -128 -225 -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -connection root2; -CALL stp_t (127, 227); -i -123 -124 -125 -126 -128 -227 -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 227 5 127 -6 128 6 128 -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 227 5 127 -6 128 6 128 -connection default; -CALL stp_t (123, 223); -i -124 -125 -126 -127 -128 -223 -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -connection root1; -CALL stp_t (126, 226); -i -123 -124 -127 -128 -225 -226 -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -5 127 5 127 -6 128 6 128 -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -5 127 5 127 -6 128 6 128 -connection root2; -CALL stp_t (128, 228); -i -123 -124 -125 -126 -227 -228 -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 227 5 127 -6 228 6 128 -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 227 5 127 -6 228 6 128 -connection default; -CALL stp_t (124, 224); -i -125 -126 -127 -128 -223 -224 -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -connection root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -5 127 5 127 -6 128 6 128 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -5 127 5 127 -6 128 6 128 -connection root2; -DELETE FROM t1 WHERE t1.i=228; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 227 5 127 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -5 227 5 127 -6 228 6 128 -connection default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -COMMIT; -connection root1; -ROLLBACK; -connection root1; -COMMIT; -connection default; -SELECT * FROM v1 ORDER BY i; -i -125 -126 -127 -128 -223 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -connection root1; -SELECT * FROM v1 ORDER BY i; -i -125 -126 -127 -128 -223 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -5 127 5 127 -6 128 6 128 -connection root2; -SELECT * FROM v1 ORDER BY i; -i -125 -126 -223 -227 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -5 227 5 127 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -5 227 5 127 -6 228 6 128 -connection default; -DROP VIEW v1; -DROP PROCEDURE stp_t; -DROP TABLE t1, t2; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result deleted file mode 100644 index 6dbd5f834ed..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result +++ /dev/null @@ -1,46 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -DROP PROCEDURE IF EXISTS stp_t; -SET autocommit=0; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -INSERT INTO t1 VALUES (5,127,5,127); -INSERT INTO t1 VALUES (6,128,6,128); -#CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -INSERT INTO t2 VALUES (5,127,5,127); -INSERT INTO t2 VALUES (6,128,6,128); -#CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i from t1; -CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA -BEGIN -UPDATE t2 SET i = p2 WHERE i = p1; -UPDATE v1 SET i = p2 WHERE i = p1; -SELECT * FROM v1 ORDER BY i; -SELECT * FROM t1 ORDER BY t1.k; -SELECT * FROM t2 ORDER BY t2.k; -END; -| -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where -SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -i -123 -124 -connection root1; -CALL stp_t (125, 225); diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result deleted file mode 100644 index f5c745ca41c..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result +++ /dev/null @@ -1,180 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i from t1; -CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 -FOR EACH ROW BEGIN -UPDATE v1 SET i = NEW.i WHERE i = OLD.i; -END; -| -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where -SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -i -123 -124 -connection root1; -UPDATE t2 SET t2.i=225 WHERE t2.i=125; -SELECT * FROM v1 ORDER BY i; -i -123 -124 -126 -225 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 126 4 126 -connection default; -UPDATE t2 SET t2.i=223 WHERE t2.i=123; -SELECT * FROM v1 ORDER BY i; -i -124 -125 -126 -223 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 124 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -UPDATE t2 SET t2.i=226 WHERE t2.i=126; -SELECT * FROM v1 ORDER BY i; -i -123 -124 -225 -226 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -UPDATE t2 SET t2.i=224 WHERE t2.i=124; -SELECT * FROM v1 ORDER BY i; -i -125 -126 -223 -224 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -DELETE FROM t1 WHERE t1.i=226; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 123 1 123 -2 124 2 124 -3 225 3 125 -4 226 4 126 -connection default; -DELETE FROM t1 WHERE t1.i=224; -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -COMMIT; -connection root1; -ROLLBACK; -connection default; -SELECT * FROM v1 ORDER BY i; -i -125 -126 -223 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection root1; -SELECT * FROM v1 ORDER BY i; -i -125 -126 -223 -SELECT * FROM t1 ORDER BY t1.k; -k i j l -1 223 1 123 -3 125 3 125 -4 126 4 126 -SELECT * FROM t2 ORDER BY t2.k; -k i j l -1 223 1 123 -2 224 2 124 -3 125 3 125 -4 126 4 126 -connection default; -DROP TABLE t1, t2; -DROP VIEW v1; diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result deleted file mode 100644 index d6a38753c1d..00000000000 --- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result +++ /dev/null @@ -1,36 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -DROP VIEW IF EXISTS v1; -SET autocommit=0; -SET autocommit=0; -connection default; -CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t1 VALUES (1,123,1,123); -INSERT INTO t1 VALUES (2,124,2,124); -INSERT INTO t1 VALUES (3,125,3,125); -INSERT INTO t1 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t1 (i); -CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB; -INSERT INTO t2 VALUES (1,123,1,123); -INSERT INTO t2 VALUES (2,124,2,124); -INSERT INTO t2 VALUES (3,125,3,125); -INSERT INTO t2 VALUES (4,126,4,126); -#CREATE INDEX ixi ON t2 (i); -CREATE VIEW v1 AS SELECT t1.i from t1; -CREATE TRIGGER trig_t2 AFTER UPDATE ON t2 -FOR EACH ROW BEGIN -UPDATE v1 SET i = NEW.i WHERE i = OLD.i; -END; -| -COMMIT; -SELECT @@global.tx_isolation; -@@global.tx_isolation -REPEATABLE-READ -EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where -SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -i -123 -124 -connection root1; -UPDATE t2 SET t2.i=225 WHERE t2.i=125; diff --git a/mysql-test/suite/row_lock/readme.txt b/mysql-test/suite/row_lock/readme.txt deleted file mode 100644 index b43f04ecda4..00000000000 --- a/mysql-test/suite/row_lock/readme.txt +++ /dev/null @@ -1,9 +0,0 @@ -All row lock test with InnoDB have to be executed with the options - ---innodb_lock_wait_timeout=1 ---innodb_locks_unsafe_for_binlog - -for example - -perl mysql-test-run.pl --mysqld=--innodb_lock_wait_timeout=2 --mysqld=--innodb_locks_unsafe_for_binlog --suite=row_lock innodb_row_lock_2 - diff --git a/mysql-test/suite/row_lock/summary_of_sel_test.txt b/mysql-test/suite/row_lock/summary_of_sel_test.txt deleted file mode 100644 index 0fa332e957a..00000000000 --- a/mysql-test/suite/row_lock/summary_of_sel_test.txt +++ /dev/null @@ -1,36 +0,0 @@ -Test plan: -Create 2 tables with a primary key and 3 integer columns. Both get the same rows (1,123,1,123),(2,124,2,124),(3,125,3,125),(4,126,4,126). The second and third column may get an index to have cases with, without and mutilple index. Create views on the tables. Create an update trigger. Create a stored procedure updating the table. Create a stored function updating the table and deliver the key as result. - -The test isself consists of 2 sessions (transactions) running in "parallel" (same user "root") accessing and locking the same tables on basis of a row lock. Expected is that both sessions(transactions) can update the table successfully. - -First session -execute an explain to every select and one of the following selects on the first half of table t1: -- select ... where ... for update; -- select ... where ... lock in share mode; -- select ... where ... for update; -- select ... where ... lock in share mode; -- select ... ignore index ... where ... for update; -- select ... ignore index ... where ... lock in share mode; -- select ... where (select...) ... for update; -- select ... where (select...) ... lock in share mode; -- (select ... where) union (select ... where) for update; -- (select ... where) union (select ... where) lock in...; -- select ... where ... for update; -- select ... where ... lock in ...; -- select ... where ... for update; -- select ... where ... lock in ...; -Then executes -- update -- delete -- trigger accessing table t1 -- stored procedure accessing table t1 -- stored function accessing table t1 - -Second session -executes the same on the last half of table t1 - -call of mysqld with option ---innodb_locks_unsafe_for_binlog - -As the tests above work with small tables (<10 rows) there must be at least one test with a big table (>1000 rows) doing a table scan. - diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_1.test deleted file mode 100644 index e0440fe2669..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_1.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_2.test deleted file mode 100644 index 5cb3ea9f2d9..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_2.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -let $indext1= #CREATE INDEX ixi ON t1 (i); -let $indext2= #CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_3.test b/mysql-test/suite/row_lock/t/innodb_row_lock_3.test deleted file mode 100644 index 11f4dc423d6..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_3.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -let $indext1= #CREATE INDEX ixi ON t1 (i); -let $indext2= #CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_4.test b/mysql-test/suite/row_lock/t/innodb_row_lock_4.test deleted file mode 100644 index 0a8ca9c13a0..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_4.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_5.test b/mysql-test/suite/row_lock/t/innodb_row_lock_5.test deleted file mode 100644 index 7e411d31649..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_5.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $select= SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test deleted file mode 100644 index 0c5b8b41bd5..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_big_tab.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test deleted file mode 100644 index a12a07d82a9..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $nbrows= 40; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_big_tab_1.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test deleted file mode 100644 index 49e834eb2ce..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $nbrows= 40; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_big_tab_2.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test deleted file mode 100644 index 225513d3f87..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_trig.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test deleted file mode 100644 index 88dee5f23f8..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -let $indext1= #CREATE INDEX ixi ON t1 (i); -let $indext2= #CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_trig.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test deleted file mode 100644 index d6381e1da5b..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test deleted file mode 100644 index ee45e683669..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test deleted file mode 100644 index 49cba88dd23..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view_mix.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test deleted file mode 100644 index b07f3a3378a..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test +++ /dev/null @@ -1,10 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -#let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view_mix.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test deleted file mode 100644 index d507ff3296f..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view_storedp.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test deleted file mode 100644 index a1bfb16055e..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -let $indext1= #CREATE INDEX ixi ON t1 (i); -let $indext2= #CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view_storedp.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test deleted file mode 100644 index 24c76532d17..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view_trig.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test deleted file mode 100644 index a8a67d77979..00000000000 --- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_innodb.inc -SELECT @@global.innodb_table_locks into @table_locks; -SET @@global.innodb_table_locks= OFF; -let $engine= InnoDB; -let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -let $indext1= #CREATE INDEX ixi ON t1 (i); -let $indext2= #CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view_trig.inc -SET @@global.innodb_table_locks= @table_locks; diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_1.test deleted file mode 100644 index 6ac2e829008..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_1.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_2.test deleted file mode 100644 index 994ecba96b0..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_2.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -let $indext1= #CREATE INDEX ixi ON t1 (i); -let $indext2= #CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_3.test b/mysql-test/suite/row_lock/t/ndb_row_lock_3.test deleted file mode 100644 index 2de43c61c2a..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_3.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -let $indext1= #CREATE INDEX ixi ON t1 (i); -let $indext2= #CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_4.test b/mysql-test/suite/row_lock/t/ndb_row_lock_4.test deleted file mode 100644 index 72b20488c74..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_4.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_5.test b/mysql-test/suite/row_lock/t/ndb_row_lock_5.test deleted file mode 100644 index 045f127a4ef..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_5.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test deleted file mode 100644 index bf2df104e03..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_big_tab.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test deleted file mode 100644 index 4d32991d379..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test +++ /dev/null @@ -1,7 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $nbrows= 200; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_big_tab_1.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test deleted file mode 100644 index 894a83fc1b0..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test +++ /dev/null @@ -1,7 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $nbrows= 200; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_big_tab_2.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test deleted file mode 100644 index a5586a6101e..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_trig.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test deleted file mode 100644 index 7af13697ccc..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -let $indext1= #CREATE INDEX ixi ON t1 (i); -let $indext2= #CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_trig.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test deleted file mode 100644 index a1aaf5ab441..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test +++ /dev/null @@ -1,7 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view.inc - diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test deleted file mode 100644 index b8feef693e7..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test deleted file mode 100644 index a97626048d3..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view_mix.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test deleted file mode 100644 index e7a9a715785..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view_mix.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test deleted file mode 100644 index f57bcb3dd1b..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view_storedp.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test deleted file mode 100644 index b0aaa38fb93..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -let $indext1= #CREATE INDEX ixi ON t1 (i); -let $indext2= #CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view_storedp.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test deleted file mode 100644 index 9c4128d78bf..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -let $indext1= CREATE INDEX ixi ON t1 (i); -let $indext2= CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view_trig.inc diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test deleted file mode 100644 index 38c9472fb3d..00000000000 --- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test +++ /dev/null @@ -1,6 +0,0 @@ ---source include/have_ndb.inc -let $engine= NDB; -let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE; -let $indext1= #CREATE INDEX ixi ON t1 (i); -let $indext2= #CREATE INDEX ixi ON t2 (i); ---source suite/row_lock/include/row_lock_view_trig.inc From 9206f6847742a208500da660a2e76306e3fadae3 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Jul 2007 20:52:53 +0400 Subject: [PATCH 19/49] BUG#28591: make the fix work for BDB tables too: - make ha_berkeley::cmp_ref() take into account that auto-generated PKs are stored in LSB-first order. - Remove the temporary code that made the bugfix work for innodb only mysql-test/r/bdb.result: Adjust test-results. sql/ha_berkeley.cc: BUG#28591: make the fix work for BDB tables too: - make ha_berkeley::cmp_ref() take into account that auto-generated PKs are stored in LSB-first order. sql/sql_select.cc: BUG#28591: Remove "innodb only" clause as the fix now works for BDB too sql/table.cc: BUG#28591: Remove "innodb only" clause as the fix now works for BDB too --- mysql-test/r/bdb.result | 2 +- sql/ha_berkeley.cc | 6 +++++- sql/sql_select.cc | 1 - sql/table.cc | 3 +-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result index 91c385112b4..3356d23053f 100644 --- a/mysql-test/r/bdb.result +++ b/mysql-test/r/bdb.result @@ -136,8 +136,8 @@ update ignore t1 set id=1023 where id=1010; select * from t1 where parent_id=102 order by parent_id,id; id parent_id level 1008 102 2 -1010 102 2 1015 102 2 +1010 102 2 explain select level from t1 where level=1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref level level 1 const X Using index diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 2a5fe775ca6..fbfd5031656 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -2646,7 +2646,11 @@ ha_rows ha_berkeley::estimate_rows_upper_bound() int ha_berkeley::cmp_ref(const byte *ref1, const byte *ref2) { if (hidden_primary_key) - return memcmp(ref1, ref2, BDB_HIDDEN_PRIMARY_KEY_LENGTH); + { + ulonglong a=uint5korr((char*) ref1); + ulonglong b=uint5korr((char*) ref2); + return a < b ? -1 : (a > b ? 1 : 0); + } int result; Field *field; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 2d9d261bb31..d82a0fdcf41 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -12033,7 +12033,6 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx, */ if (!on_primary_key && (table->file->table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX) && - table->s->db_type == DB_TYPE_INNODB && table->s->primary_key != MAX_KEY) { on_primary_key= TRUE; diff --git a/sql/table.cc b/sql/table.cc index ce894e6910f..18a395d69af 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -782,8 +782,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, if (ha_option & HA_PRIMARY_KEY_IN_READ_INDEX) { field->part_of_key= share->keys_in_use; - if (share->db_type == DB_TYPE_INNODB && - field->part_of_sortkey.is_set(key)) + if (field->part_of_sortkey.is_set(key)) field->part_of_sortkey= share->keys_in_use; } } From 0936976e8d21a4980145d31657b862652af29f22 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Jul 2007 16:37:29 +0400 Subject: [PATCH 20/49] A fix and a test case for Bug#24918 drop table and lock / inconsistent between perm and temp tables. Review fixes. The original bug report complains that if we locked a temporary table with LOCK TABLES statement, we would not leave LOCK TABLES mode when this temporary table is dropped. Additionally, the bug was escalated when it was discovered than when a temporary transactional table that was previously locked with LOCK TABLES statement was dropped, futher actions with this table, such as UNLOCK TABLES, would lead to a crash. The problem originates from incomplete support of transactional temporary tables. When we added calls to handler::store_lock()/handler::external_lock() to operations that work with such tables, we only covered the normal server code flow and did not cover LOCK TABLES mode. In LOCK TABLES mode, ::external_lock(LOCK) would sometimes be called without matching ::external_lock(UNLOCK), e.g. when a transactional temporary table was dropped. Additionally, this table would be left in the list of LOCKed TABLES. The patch aims to address this inadequacy. Now, whenever an instance of 'handler' is destroyed, we assert that it was priorly external_lock(UNLOCK)-ed. All the places that violate this assert were fixed. This patch introduces no changes in behavior -- the discrepancy in behavior will be fixed when we start calling ::store_lock()/::external_lock() for all tables, regardless whether they are transactional or not, temporary or not. mysql-test/r/innodb_mysql.result: Update test results (Bug#24918) mysql-test/t/innodb_mysql.test: Add a test case for Bug#24918 sql/handler.h: Make handler::external_lock() a protected method. Backport from 5.1 its public wrapper handler::ha_external_lock(). Assert that the handler is not closed if it is still locked. sql/lock.cc: In mysql_lock_tables only call lock_external() for the list of tables that we called store_lock() for. E.g. get_lock_data() does not add non-transactional temporary tables to the lock list, so lock_external() should not be called for them. Use handler::ha_external_lock() instead of handler::external_lock(). Add comments for mysql_lock_remove(), parameterize one strange side effect that it has. At least in one place where mysql_lock_remove is used, this side effect is not desired (DROP TABLE). The parameter will be dropped in 5.1, along with the side effect. sql/mysql_priv.h: Update declaration of mysql_lock_remove(). sql/opt_range.cc: Deploy handler::ha_external_lock() instead of handler::external_lock() sql/sql_base.cc: When closing a temporary table, remove the table from the list of LOCKed TABLES of this thread, in case it's there. It's there if it is a transactional temporary table. Use a new declaration of mysql_lock_remove(). sql/sql_class.h: Extend the comment for THD::temporary_tables. sql/sql_table.cc: Deploy handler::ha_external_lock() instead of handler::external_lock() --- mysql-test/r/innodb_mysql.result | 28 ++++++++++++++++++++++ mysql-test/t/innodb_mysql.test | 34 +++++++++++++++++++++++++++ sql/handler.h | 40 +++++++++++++++++++++++++++++--- sql/lock.cc | 35 +++++++++++++++++++++++----- sql/mysql_priv.h | 3 ++- sql/opt_range.cc | 6 ++--- sql/sql_base.cc | 40 ++++++++++++++++++++++++++++---- sql/sql_class.h | 24 ++++++++++++++----- sql/sql_table.cc | 10 ++++---- 9 files changed, 192 insertions(+), 28 deletions(-) diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index f32878309b8..6fb98f509ef 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -739,4 +739,32 @@ drop table if exists t1; create table t1 (a int) engine=innodb; alter table t1 alter a set default 1; drop table t1; + +Bug#24918 drop table and lock / inconsistent between +perm and temp tables + +Check transactional tables under LOCK TABLES + +drop table if exists t24918, t24918_tmp, t24918_trans, t24918_trans_tmp, +t24918_access; +create table t24918_access (id int); +create table t24918 (id int) engine=myisam; +create temporary table t24918_tmp (id int) engine=myisam; +create table t24918_trans (id int) engine=innodb; +create temporary table t24918_trans_tmp (id int) engine=innodb; +lock table t24918 write, t24918_tmp write, t24918_trans write, t24918_trans_tmp write; +drop table t24918; +select * from t24918_access; +ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES +drop table t24918_trans; +select * from t24918_access; +ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES +drop table t24918_trans_tmp; +select * from t24918_access; +ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES +drop table t24918_tmp; +select * from t24918_access; +ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES +unlock tables; +drop table t24918_access; End of 5.0 tests diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index 0d43d13ec3a..60d46863bfd 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -754,4 +754,38 @@ create table t1 (a int) engine=innodb; alter table t1 alter a set default 1; drop table t1; + +--echo +--echo Bug#24918 drop table and lock / inconsistent between +--echo perm and temp tables +--echo +--echo Check transactional tables under LOCK TABLES +--echo +--disable_warnings +drop table if exists t24918, t24918_tmp, t24918_trans, t24918_trans_tmp, +t24918_access; +--enable_warnings +create table t24918_access (id int); +create table t24918 (id int) engine=myisam; +create temporary table t24918_tmp (id int) engine=myisam; +create table t24918_trans (id int) engine=innodb; +create temporary table t24918_trans_tmp (id int) engine=innodb; + +lock table t24918 write, t24918_tmp write, t24918_trans write, t24918_trans_tmp write; +drop table t24918; +--error ER_TABLE_NOT_LOCKED +select * from t24918_access; +drop table t24918_trans; +--error ER_TABLE_NOT_LOCKED +select * from t24918_access; +drop table t24918_trans_tmp; +--error ER_TABLE_NOT_LOCKED +select * from t24918_access; +drop table t24918_tmp; +--error ER_TABLE_NOT_LOCKED +select * from t24918_access; +unlock tables; + +drop table t24918_access; + --echo End of 5.0 tests diff --git a/sql/handler.h b/sql/handler.h index a3767573178..cd9f9a91008 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -508,6 +508,29 @@ class handler :public Sql_alloc */ virtual int rnd_init(bool scan) =0; virtual int rnd_end() { return 0; } + /** + Is not invoked for non-transactional temporary tables. + + Tells the storage engine that we intend to read or write data + from the table. This call is prefixed with a call to handler::store_lock() + and is invoked only for those handler instances that stored the lock. + + Calls to rnd_init/index_init are prefixed with this call. When table + IO is complete, we call external_lock(F_UNLCK). + A storage engine writer should expect that each call to + ::external_lock(F_[RD|WR]LOCK is followed by a call to + ::external_lock(F_UNLCK). If it is not, it is a bug in MySQL. + + The name and signature originate from the first implementation + in MyISAM, which would call fcntl to set/clear an advisory + lock on the data file in this method. + + @param lock_type F_RDLCK, F_WRLCK, F_UNLCK + + @return non-0 in case of failure, 0 in case of success. + When lock_type is F_UNLCK, the return value is ignored. + */ + virtual int external_lock(THD *thd, int lock_type) { return 0; } public: const handlerton *ht; /* storage engine of this handler */ @@ -548,6 +571,7 @@ public: uint raid_type,raid_chunks; FT_INFO *ft_handler; enum {NONE=0, INDEX, RND} inited; + bool locked; bool auto_increment_column_changed; bool implicit_emptied; /* Can be !=0 only if HEAP */ const COND *pushed_cond; @@ -560,10 +584,11 @@ public: create_time(0), check_time(0), update_time(0), key_used_on_scan(MAX_KEY), active_index(MAX_KEY), ref_length(sizeof(my_off_t)), block_size(0), - raid_type(0), ft_handler(0), inited(NONE), implicit_emptied(0), + raid_type(0), ft_handler(0), inited(NONE), + locked(FALSE), implicit_emptied(0), pushed_cond(NULL) {} - virtual ~handler(void) { /* TODO: DBUG_ASSERT(inited == NONE); */ } + virtual ~handler(void) { DBUG_ASSERT(locked == FALSE); /* TODO: DBUG_ASSERT(inited == NONE); */ } virtual handler *clone(MEM_ROOT *mem_root); int ha_open(const char *name, int mode, int test_if_locked); void adjust_next_insert_id_after_explicit_value(ulonglong nr); @@ -597,6 +622,13 @@ public: virtual const char *index_type(uint key_number) { DBUG_ASSERT(0); return "";} + int ha_external_lock(THD *thd, int lock_type) + { + int rc; + DBUG_ENTER("ha_external_lock"); + locked= lock_type != F_UNLCK; + DBUG_RETURN(external_lock(thd, lock_type)); + } int ha_index_init(uint idx) { DBUG_ENTER("ha_index_init"); @@ -689,7 +721,6 @@ public: virtual int extra_opt(enum ha_extra_function operation, ulong cache_size) { return extra(operation); } virtual int reset() { return extra(HA_EXTRA_RESET); } - virtual int external_lock(THD *thd, int lock_type) { return 0; } virtual void unlock_row() {} virtual int start_stmt(THD *thd, thr_lock_type lock_type) {return 0;} /* @@ -837,6 +868,9 @@ public: /* lock_count() can be more than one if the table is a MERGE */ virtual uint lock_count(void) const { return 1; } + /** + Is not invoked for non-transactional temporary tables. + */ virtual THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type)=0; diff --git a/sql/lock.cc b/sql/lock.cc index 93358e56701..f730ac56d35 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -151,7 +151,8 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, } thd->proc_info="System lock"; - if (lock_external(thd, tables, count)) + if (sql_lock->table_count && lock_external(thd, sql_lock->table, + sql_lock->table_count)) { /* Clear the lock type of all lock data to avoid reusage. */ reset_lock_data(sql_lock); @@ -246,12 +247,12 @@ static int lock_external(THD *thd, TABLE **tables, uint count) (*tables)->reginfo.lock_type <= TL_READ_NO_INSERT)) lock_type=F_RDLCK; - if ((error=(*tables)->file->external_lock(thd,lock_type))) + if ((error= (*tables)->file->ha_external_lock(thd,lock_type))) { print_lock_error(error, (*tables)->file->table_type()); for (; i-- ; tables--) { - (*tables)->file->external_lock(thd, F_UNLCK); + (*tables)->file->ha_external_lock(thd, F_UNLCK); (*tables)->current_lock=F_UNLCK; } DBUG_RETURN(error); @@ -353,10 +354,28 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock) } +/** + Try to find the table in the list of locked tables. + In case of success, unlock the table and remove it from this list. -void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table) + @note This function has a legacy side effect: the table is + unlocked even if it is not found in the locked list. + It's not clear if this side effect is intentional or still + desirable. It might lead to unmatched calls to + unlock_external(). Moreover, a discrepancy can be left + unnoticed by the storage engine, because in + unlock_external() we call handler::external_lock(F_UNLCK) only + if table->current_lock is not F_UNLCK. + + @param always_unlock specify explicitly if the legacy side + effect is desired. +*/ + +void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table, + bool always_unlock) { - mysql_unlock_some_tables(thd, &table,1); + if (always_unlock == TRUE) + mysql_unlock_some_tables(thd, &table, /* table count */ 1); if (locked) { reg1 uint i; @@ -370,6 +389,10 @@ void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table) DBUG_ASSERT(table->lock_position == i); + /* Unlock if not yet unlocked */ + if (always_unlock == FALSE) + mysql_unlock_some_tables(thd, &table, /* table count */ 1); + /* Decrement table_count in advance, making below expressions easier */ old_tables= --locked->table_count; @@ -623,7 +646,7 @@ static int unlock_external(THD *thd, TABLE **table,uint count) if ((*table)->current_lock != F_UNLCK) { (*table)->current_lock = F_UNLCK; - if ((error=(*table)->file->external_lock(thd, F_UNLCK))) + if ((error= (*table)->file->ha_external_lock(thd, F_UNLCK))) { error_code=error; print_lock_error(error_code, (*table)->file->table_type()); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index d14aab57489..ca6aa8ecab0 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1452,7 +1452,8 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count, void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock); void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock); void mysql_unlock_some_tables(THD *thd, TABLE **table,uint count); -void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table); +void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table, + bool always_unlock); void mysql_lock_abort(THD *thd, TABLE *table); bool mysql_lock_abort_for_thread(THD *thd, TABLE *table); MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b); diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 247f0eada49..d978c8882ac 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -972,7 +972,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT() DBUG_PRINT("info", ("Freeing separate handler 0x%lx (free: %d)", (long) file, free_file)); file->reset(); - file->external_lock(current_thd, F_UNLCK); + file->ha_external_lock(current_thd, F_UNLCK); file->close(); } } @@ -1142,7 +1142,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler) /* Caller will free the memory */ goto failure; /* purecov: inspected */ } - if (file->external_lock(thd, F_RDLCK)) + if (file->ha_external_lock(thd, F_RDLCK)) goto failure; if (!head->no_keyread) { @@ -1152,7 +1152,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler) if (file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) || init() || reset()) { - file->external_lock(thd, F_UNLCK); + file->ha_external_lock(thd, F_UNLCK); file->close(); goto failure; } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 3860dfa1ded..61847a6b168 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1037,6 +1037,31 @@ TABLE **find_temporary_table(THD *thd, const char *db, const char *table_name) return 0; // Not a temporary table } + +/** + Drop a temporary table. + + Try to locate the table in the list of thd->temporary_tables. + If the table is found: + - if the table is in thd->locked_tables, unlock it and + remove it from the list of locked tables. Currently only transactional + temporary tables are present in the locked_tables list. + - Close the temporary table, remove its .FRM + - remove the table from the list of temporary tables + + This function is used to drop user temporary tables, as well as + internal tables created in CREATE TEMPORARY TABLE ... SELECT + or ALTER TABLE. Even though part of the work done by this function + is redundant when the table is internal, as long as we + link both internal and user temporary tables into the same + thd->temporary_tables list, it's impossible to tell here whether + we're dealing with an internal or a user temporary table. + + @retval TRUE the table was not found in the list of temporary tables + of this thread + @retval FALSE the table was found and dropped successfully. +*/ + bool close_temporary_table(THD *thd, const char *db, const char *table_name) { TABLE *table,**prev; @@ -1045,6 +1070,11 @@ bool close_temporary_table(THD *thd, const char *db, const char *table_name) return 1; table= *prev; *prev= table->next; + /* + If LOCK TABLES list is not empty and contains this table, + unlock the table and remove the table from this list. + */ + mysql_lock_remove(thd, thd->locked_tables, table, FALSE); close_temporary(table, 1); if (thd->slave_thread) --slave_open_temp_tables; @@ -1120,7 +1150,7 @@ TABLE *unlink_open_table(THD *thd, TABLE *list, TABLE *find) !memcmp(list->s->table_cache_key, key, key_length)) { if (thd->locked_tables) - mysql_lock_remove(thd, thd->locked_tables,list); + mysql_lock_remove(thd, thd->locked_tables, list, TRUE); VOID(hash_delete(&open_cache,(byte*) list)); // Close table } else @@ -1151,6 +1181,8 @@ TABLE *unlink_open_table(THD *thd, TABLE *list, TABLE *find) dropped is already unlocked. In the former case it will also remove lock on the table. But one should not rely on this behaviour as it may change in future. + Currently, however, this function is never called for a + table that was locked with LOCK TABLES. */ void drop_open_table(THD *thd, TABLE *table, const char *db_name, @@ -2099,7 +2131,7 @@ bool close_data_tables(THD *thd,const char *db, const char *table_name) if (!strcmp(table->s->table_name, table_name) && !strcmp(table->s->db, db)) { - mysql_lock_remove(thd, thd->locked_tables,table); + mysql_lock_remove(thd, thd->locked_tables, table, TRUE); table->file->close(); table->db_stat=0; } @@ -2239,7 +2271,7 @@ void close_old_data_files(THD *thd, TABLE *table, bool morph_locks, instances of this table. */ mysql_lock_abort(thd, table); - mysql_lock_remove(thd, thd->locked_tables, table); + mysql_lock_remove(thd, thd->locked_tables, table, TRUE); /* We want to protect the table from concurrent DDL operations (like RENAME TABLE) until we will re-open and re-lock it. @@ -2343,7 +2375,7 @@ bool drop_locked_tables(THD *thd,const char *db, const char *table_name) if (!strcmp(table->s->table_name, table_name) && !strcmp(table->s->db, db)) { - mysql_lock_remove(thd, thd->locked_tables,table); + mysql_lock_remove(thd, thd->locked_tables, table, TRUE); VOID(hash_delete(&open_cache,(byte*) table)); found=1; } diff --git a/sql/sql_class.h b/sql/sql_class.h index 058f130d4e7..6ffbd9b4ac7 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -995,13 +995,25 @@ enum prelocked_mode_type {NON_PRELOCKED= 0, PRELOCKED= 1, class Open_tables_state { public: - /* - open_tables - list of regular tables in use by this thread - temporary_tables - list of temp tables in use by this thread - handler_tables - list of tables that were opened with HANDLER OPEN - and are still in use by this thread + /** + List of regular tables in use by this thread. Contains temporary and + base tables that were opened with @see open_tables(). */ - TABLE *open_tables, *temporary_tables, *handler_tables, *derived_tables; + TABLE *open_tables; + /** + List of temporary tables used by this thread. Contains user-level + temporary tables, created with CREATE TEMPORARY TABLE, and + internal temporary tables, created, e.g., to resolve a SELECT, + or for an intermediate table used in ALTER. + XXX Why are internal temporary tables added to this list? + */ + TABLE *temporary_tables; + /** + List of tables that were opened with HANDLER OPEN and are + still in use by this thread. + */ + TABLE *handler_tables; + TABLE *derived_tables; /* During a MySQL session, one can lock tables in two modes: automatic or manual. In automatic mode all necessary tables are locked just before diff --git a/sql/sql_table.cc b/sql/sql_table.cc index e02595836ca..f11082a712c 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3791,10 +3791,10 @@ view_err: { VOID(pthread_mutex_lock(&LOCK_open)); wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN); - table->file->external_lock(thd, F_WRLCK); + table->file->ha_external_lock(thd, F_WRLCK); alter_table_manage_keys(table, table->file->indexes_are_disabled(), alter_info->keys_onoff); - table->file->external_lock(thd, F_UNLCK); + table->file->ha_external_lock(thd, F_UNLCK); VOID(pthread_mutex_unlock(&LOCK_open)); error= ha_commit_stmt(thd); if (ha_commit(thd)) @@ -3813,7 +3813,7 @@ view_err: The following function call will free the new_table pointer, in close_temporary_table(), so we can safely directly jump to err */ - close_temporary_table(thd,new_db,tmp_name); + close_temporary_table(thd, new_db, tmp_name); goto err; } /* Close lock if this is a transactional table */ @@ -4086,7 +4086,7 @@ copy_data_between_tables(TABLE *from,TABLE *to, if (!(copy= new Copy_field[to->s->fields])) DBUG_RETURN(-1); /* purecov: inspected */ - if (to->file->external_lock(thd, F_WRLCK)) + if (to->file->ha_external_lock(thd, F_WRLCK)) DBUG_RETURN(-1); /* We need external lock before we can disable/enable keys */ @@ -4238,7 +4238,7 @@ copy_data_between_tables(TABLE *from,TABLE *to, free_io_cache(from); *copied= found_count; *deleted=delete_count; - if (to->file->external_lock(thd,F_UNLCK)) + if (to->file->ha_external_lock(thd,F_UNLCK)) error=1; DBUG_RETURN(error > 0 ? -1 : 0); } From aad42dc7f4484de4ac3b635e8db59ff2c0665bd2 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Jul 2007 15:14:21 +0200 Subject: [PATCH 21/49] More fixes and cleanups for bug#28585: - make the 'dist-hook' from top-level Makefile work again. - we can find my_print_defaults from --basedir by parsing command line arguments prior to running my_print_defaults. - take advantage of additional command line parsing and allow the --no-defaults etc arguments to work anywhere rather than having to be the first argument. - find SQL files either from binary archive or source install. - consolidate and tidy code and error messages. scripts/mysql_install_db.sh: Consolidate error messages. --- scripts/mysql_install_db.sh | 109 ++++++++++++++++++++++++++---------- 1 file changed, 79 insertions(+), 30 deletions(-) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 7e1f6217b7b..a66129af1d3 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -32,12 +32,6 @@ in_rpm=0 ip_only=0 windows=0 -case "$1" in - --no-defaults|--defaults-file=*|--defaults-extra-file=*) - defaults="$1"; shift - ;; -esac - usage() { cat < Date: Fri, 27 Jul 2007 18:42:25 +0500 Subject: [PATCH 22/49] Bug #29878 Garbage data generation when executing SESSION_USER() on a slave. Item_func_user doesn't calculate anything in it's val_str() method, just returns saved str_value. Though Item::save_in_field method can destroy str_value, relying on val_str() return. As a result we get the garbage stored in field. We cannot use Item::save_in_field implementation for Item_func_user, reimplement it in simpler way. mysql-test/r/rpl_session_var.result: Bug #29878 Garbage data generation when executing SESSION_USER() on a slave. test result mysql-test/t/rpl_session_var.test: Bug #29878 Garbage data generation when executing SESSION_USER() on a slave. test case sql/item.cc: Bug #29878 Garbage data generation when executing SESSION_USER() on a slave. duplicating code moved to Item::save_str_in_field sql/item.h: Bug #29878 Garbage data generation when executing SESSION_USER() on a slave. duplicating code moved to Item::save_str_in_field sql/item_strfunc.h: Bug #29878 Garbage data generation when executing SESSION_USER() on a slave. Item_func_user::save_in_field implemented as simple storing str_value --- mysql-test/r/rpl_session_var.result | 10 ++++++ mysql-test/t/rpl_session_var.test | 22 ++++++++++++ sql/item.cc | 52 +++++++++++++++++++++-------- sql/item.h | 6 +++- sql/item_strfunc.h | 4 +++ 5 files changed, 79 insertions(+), 15 deletions(-) diff --git a/mysql-test/r/rpl_session_var.result b/mysql-test/r/rpl_session_var.result index b5b4b815ade..787899932d6 100644 --- a/mysql-test/r/rpl_session_var.result +++ b/mysql-test/r/rpl_session_var.result @@ -41,3 +41,13 @@ select * from t2 order by b; b a 1 1 drop table t1,t2; +CREATE TABLE t1 ( +`id` int(11) NOT NULL auto_increment, +`data` varchar(100), +PRIMARY KEY (`id`) +) ENGINE=MyISAM; +INSERT INTO t1(data) VALUES(SESSION_USER()); +SELECT * FROM t1; +id data +1 +drop table t1; diff --git a/mysql-test/t/rpl_session_var.test b/mysql-test/t/rpl_session_var.test index a6f4b496a23..8231a0dbefd 100644 --- a/mysql-test/t/rpl_session_var.test +++ b/mysql-test/t/rpl_session_var.test @@ -40,3 +40,25 @@ drop table t1,t2; save_master_pos; connection slave; sync_with_master; + +# +# Bug #29878 Garbage data generation when executing SESSION_USER() on a slave. +# + +connection master; +CREATE TABLE t1 ( + `id` int(11) NOT NULL auto_increment, + `data` varchar(100), + PRIMARY KEY (`id`) + ) ENGINE=MyISAM; + +INSERT INTO t1(data) VALUES(SESSION_USER()); +save_master_pos; +connection slave; +sync_with_master; +SELECT * FROM t1; +connection master; +drop table t1; +save_master_pos; +connection slave; +sync_with_master; diff --git a/sql/item.cc b/sql/item.cc index 2fc58eebe75..bd47fb706a6 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -336,6 +336,37 @@ int Item::save_date_in_field(Field *field) } +/* + Store the string value in field directly + + SYNOPSIS + Item::save_str_value_in_field() + field a pointer to field where to store + result the pointer to the string value to be stored + + DESCRIPTION + The method is used by Item_*::save_in_field implementations + when we don't need to calculate the value to store + See Item_string::save_in_field() implementation for example + + IMPLEMENTATION + Check if the Item is null and stores the NULL or the + result value in the field accordingly. + + RETURN + Nonzero value if error +*/ + +int Item::save_str_value_in_field(Field *field, String *result) +{ + if (null_value) + return set_field_to_null(field); + field->set_notnull(); + return field->store(result->ptr(), result->length(), + collation.collation); +} + + Item::Item(): rsize(0), name(0), orig_name(0), name_length(0), fixed(0), is_autogenerated_name(TRUE), @@ -3009,16 +3040,6 @@ my_decimal *Item_copy_string::val_decimal(my_decimal *decimal_value) } - -int Item_copy_string::save_in_field(Field *field, bool no_conversions) -{ - if (null_value) - return set_field_to_null(field); - field->set_notnull(); - return field->store(str_value.ptr(),str_value.length(), - collation.collation); -} - /* Functions to convert item to field (for send_fields) */ @@ -4417,6 +4438,12 @@ int Item_null::save_safe_in_field(Field *field) } +/* + This implementation can lose str_value content, so if the + Item uses str_value to store something, it should + reimplement it's ::save_in_field() as Item_string, for example, does +*/ + int Item::save_in_field(Field *field, bool no_conversions) { int error; @@ -4474,10 +4501,7 @@ int Item_string::save_in_field(Field *field, bool no_conversions) { String *result; result=val_str(&str_value); - if (null_value) - return set_field_to_null(field); - field->set_notnull(); - return field->store(result->ptr(),result->length(),collation.collation); + return save_str_value_in_field(field, result); } diff --git a/sql/item.h b/sql/item.h index 5b1a80a5f03..72236cb5e63 100644 --- a/sql/item.h +++ b/sql/item.h @@ -612,6 +612,7 @@ public: int save_time_in_field(Field *field); int save_date_in_field(Field *field); + int save_str_value_in_field(Field *field, String *result); virtual Field *get_tmp_table_field() { return 0; } /* This is also used to create fields in CREATE ... SELECT: */ @@ -2166,7 +2167,10 @@ public: my_decimal *val_decimal(my_decimal *); void make_field(Send_field *field) { item->make_field(field); } void copy(); - int save_in_field(Field *field, bool no_conversions); + int save_in_field(Field *field, bool no_conversions) + { + return save_str_value_in_field(field, &str_value); + } table_map used_tables() const { return (table_map) 1L; } bool const_item() const { return 0; } bool is_null() { return null_value; } diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index d7c4a3eddef..6ca0b89a22b 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -434,6 +434,10 @@ public: } const char *func_name() const { return "user"; } const char *fully_qualified_func_name() const { return "user()"; } + int save_in_field(Field *field, bool no_conversions) + { + return save_str_value_in_field(field, &str_value); + } }; From 07955aea2dc369be7637f28331bd1072a995d572 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Jul 2007 16:56:29 +0200 Subject: [PATCH 23/49] Bug #29929 LOCK TABLES does not pre-lock tables used in triggers of the locked tables When a table was explicitly locked with LOCK TABLES no associated tables from any related trigger on the subject table were locked. As a result of this the user could experience unexpected locking behavior and statement failures similar to "failed: 1100: Table'xx' was not locked with LOCK TABLES". This patch fixes this problem by making sure triggers are pre-loaded on any statement if the subject table was explicitly locked with LOCK TABLES. mysql-test/r/sp-prelocking.result: Added test case mysql-test/t/sp-prelocking.test: Added test case sql/sql_lex.cc: - Moved some conditional logic out of the table iteration. - Added event map values for LOCK TABLE command. sql/table.cc: - Refactored set_trg_event_tpye into the two simpler functions set_trg_event_map and set_trg_event_map as methods for manipulating the table event map. The original function was only called from st_lex::set_trg_event_type_for_tables so it was possible to move the event map creation logic to this function as a loop optimization. sql/table.h: - Refactored set_trg_event_tpye into the two simpler functions set_trg_event_map and set_trg_event_map as methods for manipulating the table event map. The original function was only called from st_lex::set_trg_event_type_for_tables so it was possible to move the event map creation logic to this function as a loop optimization. --- mysql-test/r/sp-prelocking.result | 30 +++++++ mysql-test/t/sp-prelocking.test | 31 +++++++ sql/sql_lex.cc | 135 +++++++++++++++++++++++++++++- sql/table.cc | 129 ---------------------------- sql/table.h | 1 - 5 files changed, 193 insertions(+), 133 deletions(-) diff --git a/mysql-test/r/sp-prelocking.result b/mysql-test/r/sp-prelocking.result index c19bd1abd26..186b2c05d34 100644 --- a/mysql-test/r/sp-prelocking.result +++ b/mysql-test/r/sp-prelocking.result @@ -289,4 +289,34 @@ create table t1 select f_bug22427() as i; ERROR 42S01: Table 't1' already exists drop table t1; drop function f_bug22427; +# +# Bug #29929 LOCK TABLES does not pre-lock tables used in triggers of the locked tables +# +DROP table IF EXISTS t1,t2; +CREATE TABLE t1 (c1 INT); +CREATE TABLE t2 (c2 INT); +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (2); +CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW +BEGIN +UPDATE t2 SET c2= c2 + 1; +END// +# Take a table lock on t1. +# This should pre-lock t2 through the trigger. +LOCK TABLE t1 WRITE; +INSERT INTO t1 VALUES (3); +UNLOCK TABLES; +LOCK TABLE t1 READ; +INSERT INTO t2 values(4); +ERROR HY000: Table 't2' was not locked with LOCK TABLES +UNLOCK TABLES; +SELECT * FROM t1; +c1 +1 +3 +SELECT * FROM t2; +c2 +3 +DROP TRIGGER t1_ai; +DROP TABLE t1, t2; End of 5.0 tests diff --git a/mysql-test/t/sp-prelocking.test b/mysql-test/t/sp-prelocking.test index 60e97260839..966c59a5789 100644 --- a/mysql-test/t/sp-prelocking.test +++ b/mysql-test/t/sp-prelocking.test @@ -356,4 +356,35 @@ create table t1 select f_bug22427() as i; drop table t1; drop function f_bug22427; +--echo # +--echo # Bug #29929 LOCK TABLES does not pre-lock tables used in triggers of the locked tables +--echo # +--disable_warnings +DROP table IF EXISTS t1,t2; +--enable_warnings +CREATE TABLE t1 (c1 INT); +CREATE TABLE t2 (c2 INT); +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (2); +DELIMITER //; +CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW +BEGIN +UPDATE t2 SET c2= c2 + 1; +END// +DELIMITER ;// +--echo # Take a table lock on t1. +--echo # This should pre-lock t2 through the trigger. +LOCK TABLE t1 WRITE; +INSERT INTO t1 VALUES (3); +UNLOCK TABLES; +LOCK TABLE t1 READ; +--error ER_TABLE_NOT_LOCKED +INSERT INTO t2 values(4); +UNLOCK TABLES; +SELECT * FROM t1; +SELECT * FROM t2; +DROP TRIGGER t1_ai; +DROP TABLE t1, t2; + --echo End of 5.0 tests + diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index c37d77345b6..106dcf88a84 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -2035,12 +2035,131 @@ void st_select_lex_unit::set_limit(SELECT_LEX *sl) /** - Update the parsed tree with information about triggers that - may be fired when executing this statement. + @brief Set the initial purpose of this TABLE_LIST object in the list of used + tables. + + We need to track this information on table-by-table basis, since when this + table becomes an element of the pre-locked list, it's impossible to identify + which SQL sub-statement it has been originally used in. + + E.g.: + + User request: SELECT * FROM t1 WHERE f1(); + FUNCTION f1(): DELETE FROM t2; RETURN 1; + BEFORE DELETE trigger on t2: INSERT INTO t3 VALUES (old.a); + + For this user request, the pre-locked list will contain t1, t2, t3 + table elements, each needed for different DML. + + The trigger event map is updated to reflect INSERT, UPDATE, DELETE, + REPLACE, LOAD DATA, CREATE TABLE .. SELECT, CREATE TABLE .. + REPLACE SELECT statements, and additionally ON DUPLICATE KEY UPDATE + clause. */ void st_lex::set_trg_event_type_for_tables() { + enum trg_event_type trg_event; + + uint8 new_trg_event_map= 0; + + /* + Some auxiliary operations + (e.g. GRANT processing) create TABLE_LIST instances outside + the parser. Additionally, some commands (e.g. OPTIMIZE) change + the lock type for a table only after parsing is done. Luckily, + these do not fire triggers and do not need to pre-load them. + For these TABLE_LISTs set_trg_event_type is never called, and + trg_event_map is always empty. That means that the pre-locking + algorithm will ignore triggers defined on these tables, if + any, and the execution will either fail with an assert in + sql_trigger.cc or with an error that a used table was not + pre-locked, in case of a production build. + + TODO: this usage pattern creates unnecessary module dependencies + and should be rewritten to go through the parser. + Table list instances created outside the parser in most cases + refer to mysql.* system tables. It is not allowed to have + a trigger on a system table, but keeping track of + initialization provides extra safety in case this limitation + is circumvented. + */ + + switch (sql_command) { + case SQLCOM_LOCK_TABLES: + /* + On a LOCK TABLE, all triggers must be pre-loaded for this TABLE_LIST + when opening an associated TABLE. + */ + new_trg_event_map= static_cast + (1 << static_cast(TRG_EVENT_INSERT)) | + static_cast + (1 << static_cast(TRG_EVENT_UPDATE)) | + static_cast + (1 << static_cast(TRG_EVENT_DELETE)); + break; + /* + Basic INSERT. If there is an additional ON DUPLIATE KEY UPDATE + clause, it will be handled later in this method. + */ + case SQLCOM_INSERT: /* fall through */ + case SQLCOM_INSERT_SELECT: + /* + LOAD DATA ... INFILE is expected to fire BEFORE/AFTER INSERT + triggers. + If the statement also has REPLACE clause, it will be + handled later in this method. + */ + case SQLCOM_LOAD: /* fall through */ + /* + REPLACE is semantically equivalent to INSERT. In case + of a primary or unique key conflict, it deletes the old + record and inserts a new one. So we also may need to + fire ON DELETE triggers. This functionality is handled + later in this method. + */ + case SQLCOM_REPLACE: /* fall through */ + case SQLCOM_REPLACE_SELECT: + /* + CREATE TABLE ... SELECT defaults to INSERT if the table or + view already exists. REPLACE option of CREATE TABLE ... + REPLACE SELECT is handled later in this method. + */ + case SQLCOM_CREATE_TABLE: + new_trg_event_map|= static_cast + (1 << static_cast(TRG_EVENT_INSERT)); + break; + /* Basic update and multi-update */ + case SQLCOM_UPDATE: /* fall through */ + case SQLCOM_UPDATE_MULTI: + new_trg_event_map|= static_cast + (1 << static_cast(TRG_EVENT_UPDATE)); + break; + /* Basic delete and multi-delete */ + case SQLCOM_DELETE: /* fall through */ + case SQLCOM_DELETE_MULTI: + new_trg_event_map|= static_cast + (1 << static_cast(TRG_EVENT_DELETE)); + break; + default: + break; + } + + switch (duplicates) { + case DUP_UPDATE: + new_trg_event_map|= static_cast + (1 << static_cast(TRG_EVENT_UPDATE)); + break; + case DUP_REPLACE: + new_trg_event_map|= static_cast + (1 << static_cast(TRG_EVENT_DELETE)); + break; + case DUP_ERROR: + default: + break; + } + + /* Do not iterate over sub-selects, only the tables in the outermost SELECT_LEX can be modified, if any. @@ -2049,7 +2168,17 @@ void st_lex::set_trg_event_type_for_tables() while (tables) { - tables->set_trg_event_type(this); + /* + This is a fast check to filter out statements that do + not change data, or tables on the right side, in case of + INSERT .. SELECT, CREATE TABLE .. SELECT and so on. + Here we also filter out OPTIMIZE statement and non-updateable + views, for which lock_type is TL_UNLOCK or TL_READ after + parsing. + */ + if (static_cast(tables->lock_type) >= + static_cast(TL_WRITE_ALLOW_WRITE)) + tables->trg_event_map= new_trg_event_map; tables= tables->next_local; } } diff --git a/sql/table.cc b/sql/table.cc index f24f5c6fbcc..f27076076bf 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1776,135 +1776,6 @@ void st_table::reset_item_list(List *item_list) const } } - -/** - Set the initial purpose of this TABLE_LIST object in the list of - used tables. We need to track this information on table-by- - table basis, since when this table becomes an element of the - pre-locked list, it's impossible to identify which SQL - sub-statement it has been originally used in. - - E.g.: - - User request: SELECT * FROM t1 WHERE f1(); - FUNCTION f1(): DELETE FROM t2; RETURN 1; - BEFORE DELETE trigger on t2: INSERT INTO t3 VALUES (old.a); - - For this user request, the pre-locked list will contain t1, t2, t3 - table elements, each needed for different DML. - - This method is called immediately after parsing for tables - of the table list of the top-level select lex. - - The trigger event map is updated to reflect INSERT, UPDATE, DELETE, - REPLACE, LOAD DATA, CREATE TABLE .. SELECT, CREATE TABLE .. - REPLACE SELECT statements, and additionally ON DUPLICATE KEY UPDATE - clause. -*/ - -void -TABLE_LIST::set_trg_event_type(const st_lex *lex) -{ - enum trg_event_type trg_event; - - /* - Some auxiliary operations - (e.g. GRANT processing) create TABLE_LIST instances outside - the parser. Additionally, some commands (e.g. OPTIMIZE) change - the lock type for a table only after parsing is done. Luckily, - these do not fire triggers and do not need to pre-load them. - For these TABLE_LISTs set_trg_event_type is never called, and - trg_event_map is always empty. That means that the pre-locking - algorithm will ignore triggers defined on these tables, if - any, and the execution will either fail with an assert in - sql_trigger.cc or with an error that a used table was not - pre-locked, in case of a production build. - - TODO: this usage pattern creates unnecessary module dependencies - and should be rewritten to go through the parser. - Table list instances created outside the parser in most cases - refer to mysql.* system tables. It is not allowed to have - a trigger on a system table, but keeping track of - initialization provides extra safety in case this limitation - is circumvented. - */ - - /* - This is a fast check to filter out statements that do - not change data, or tables on the right side, in case of - INSERT .. SELECT, CREATE TABLE .. SELECT and so on. - Here we also filter out OPTIMIZE statement and non-updateable - views, for which lock_type is TL_UNLOCK or TL_READ after - parsing. - */ - if (static_cast(lock_type) < static_cast(TL_WRITE_ALLOW_WRITE)) - return; - - switch (lex->sql_command) { - /* - Basic INSERT. If there is an additional ON DUPLIATE KEY UPDATE - clause, it will be handled later in this method. - */ - case SQLCOM_INSERT: /* fall through */ - case SQLCOM_INSERT_SELECT: - /* - LOAD DATA ... INFILE is expected to fire BEFORE/AFTER INSERT - triggers. - If the statement also has REPLACE clause, it will be - handled later in this method. - */ - case SQLCOM_LOAD: /* fall through */ - /* - REPLACE is semantically equivalent to INSERT. In case - of a primary or unique key conflict, it deletes the old - record and inserts a new one. So we also may need to - fire ON DELETE triggers. This functionality is handled - later in this method. - */ - case SQLCOM_REPLACE: /* fall through */ - case SQLCOM_REPLACE_SELECT: - /* - CREATE TABLE ... SELECT defaults to INSERT if the table or - view already exists. REPLACE option of CREATE TABLE ... - REPLACE SELECT is handled later in this method. - */ - case SQLCOM_CREATE_TABLE: - trg_event= TRG_EVENT_INSERT; - break; - /* Basic update and multi-update */ - case SQLCOM_UPDATE: /* fall through */ - case SQLCOM_UPDATE_MULTI: - trg_event= TRG_EVENT_UPDATE; - break; - /* Basic delete and multi-delete */ - case SQLCOM_DELETE: /* fall through */ - case SQLCOM_DELETE_MULTI: - trg_event= TRG_EVENT_DELETE; - break; - default: - /* - OK to return, since value of 'duplicates' is irrelevant - for non-updating commands. - */ - return; - } - trg_event_map|= static_cast(1 << static_cast(trg_event)); - - switch (lex->duplicates) { - case DUP_UPDATE: - trg_event= TRG_EVENT_UPDATE; - break; - case DUP_REPLACE: - trg_event= TRG_EVENT_DELETE; - break; - case DUP_ERROR: - default: - return; - } - trg_event_map|= static_cast(1 << static_cast(trg_event)); -} - - /* calculate md5 of query diff --git a/sql/table.h b/sql/table.h index f8f7d7f06b7..f411ce489c4 100644 --- a/sql/table.h +++ b/sql/table.h @@ -770,7 +770,6 @@ struct TABLE_LIST void reinit_before_use(THD *thd); Item_subselect *containing_subselect(); - void set_trg_event_type(const st_lex *lex); private: bool prep_check_option(THD *thd, uint8 check_opt_type); bool prep_where(THD *thd, Item **conds, bool no_where_clause); From 987ef94079b87101562de07475a7f1983a160ed7 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Jul 2007 17:39:07 +0200 Subject: [PATCH 24/49] SSL/Makefile.am mysql-test/Makefile.am: Moved CERT files to where they are used, avoids conflict between two make files trying to install the same CERTs SSL/*.pem, Move: SSL/*.pem -> mysql-test/std_data/ mysql-test/std_data/cacert.pem: Rename: SSL/cacert.pem -> mysql-test/std_data/cacert.pem mysql-test/std_data/client-cert.pem: Rename: SSL/client-cert.pem -> mysql-test/std_data/client-cert.pem mysql-test/std_data/client-key.pem: Rename: SSL/client-key.pem -> mysql-test/std_data/client-key.pem mysql-test/std_data/server-cert.pem: Rename: SSL/server-cert.pem -> mysql-test/std_data/server-cert.pem mysql-test/std_data/server-key.pem: Rename: SSL/server-key.pem -> mysql-test/std_data/server-key.pem SSL/Makefile.am: Moved CERT files to where they are used, avoids conflict between two make files trying to install the same CERTs --- SSL/Makefile.am | 4 +--- mysql-test/Makefile.am | 18 +----------------- {SSL => mysql-test/std_data}/cacert.pem | 0 {SSL => mysql-test/std_data}/client-cert.pem | 0 {SSL => mysql-test/std_data}/client-key.pem | 0 {SSL => mysql-test/std_data}/server-cert.pem | 0 {SSL => mysql-test/std_data}/server-key.pem | 0 7 files changed, 2 insertions(+), 20 deletions(-) rename {SSL => mysql-test/std_data}/cacert.pem (100%) rename {SSL => mysql-test/std_data}/client-cert.pem (100%) rename {SSL => mysql-test/std_data}/client-key.pem (100%) rename {SSL => mysql-test/std_data}/server-cert.pem (100%) rename {SSL => mysql-test/std_data}/server-key.pem (100%) diff --git a/SSL/Makefile.am b/SSL/Makefile.am index 5fc44d3a247..30a6fc3c995 100644 --- a/SSL/Makefile.am +++ b/SSL/Makefile.am @@ -15,9 +15,7 @@ ## Process this file with automake to create Makefile.in -EXTRA_DIST= NOTES cacert.pem client-cert.pem client-key.pem \ - run-client run-server server-cert.pem \ - server-key.pem +EXTRA_DIST= NOTES run-client run-server # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 1920a68b21b..439b13af779 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -37,12 +37,7 @@ EXTRA_DIST = $(EXTRA_SCRIPTS) suite GENSCRIPTS = mysql-test-run-shell mysql-test-run install_test_db mtr PRESCRIPTS = mysql-test-run.pl mysql-stress-test.pl test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS) -test_DATA = std_data/client-key.pem \ - std_data/client-cert.pem \ - std_data/cacert.pem \ - std_data/server-cert.pem \ - std_data/server-key.pem -CLEANFILES = $(GENSCRIPTS) $(test_DATA) +CLEANFILES = $(GENSCRIPTS) INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I.. @@ -111,17 +106,6 @@ install-data-local: uninstall-local: @RM@ -f -r $(DESTDIR)$(testdir) -std_data/client-key.pem: $(top_srcdir)/SSL/$(@F) - @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data -std_data/client-cert.pem: $(top_srcdir)/SSL/$(@F) - @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data -std_data/cacert.pem: $(top_srcdir)/SSL/$(@F) - @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data -std_data/server-cert.pem: $(top_srcdir)/SSL/$(@F) - @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data -std_data/server-key.pem: $(top_srcdir)/SSL/$(@F) - @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data - # mtr - a shortcut for executing mysql-test-run.pl mtr: $(RM) -f mtr diff --git a/SSL/cacert.pem b/mysql-test/std_data/cacert.pem similarity index 100% rename from SSL/cacert.pem rename to mysql-test/std_data/cacert.pem diff --git a/SSL/client-cert.pem b/mysql-test/std_data/client-cert.pem similarity index 100% rename from SSL/client-cert.pem rename to mysql-test/std_data/client-cert.pem diff --git a/SSL/client-key.pem b/mysql-test/std_data/client-key.pem similarity index 100% rename from SSL/client-key.pem rename to mysql-test/std_data/client-key.pem diff --git a/SSL/server-cert.pem b/mysql-test/std_data/server-cert.pem similarity index 100% rename from SSL/server-cert.pem rename to mysql-test/std_data/server-cert.pem diff --git a/SSL/server-key.pem b/mysql-test/std_data/server-key.pem similarity index 100% rename from SSL/server-key.pem rename to mysql-test/std_data/server-key.pem From 32cc0694bf6d5c8673f4c270793dedb5a8a8ab1e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Jul 2007 11:54:54 -0400 Subject: [PATCH 25/49] Bug#30103 CMake build solution does not remove auto-generated resources - Add CMake rule to remove files. --- sql/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 0cbeb97184f..b0553f622f8 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -138,6 +138,10 @@ ADD_CUSTOM_COMMAND( ) ADD_DEPENDENCIES(mysqld${MYSQLD_EXE_SUFFIX} gen_lex_hash) +# Remove the auto-generated files as part of 'Clean Solution' +SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES + "lex_hash.h;message.rc;message.h;sql_yacc.h;sql_yacc.cc") + ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def) ADD_DEPENDENCIES(udf_example strings) TARGET_LINK_LIBRARIES(udf_example wsock32) From 40d596c200bd03b5fb01ba5b9af5912d65cc586d Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Jul 2007 15:01:29 +0400 Subject: [PATCH 26/49] Bug#29856: Insufficient buffer space led to a server crash. The subst_spvars function is used to create query string with SP variables substituted with their values. This string is used later for the binary log and for the query cache. The problem is that the query_cache_send_result_to_client function requires some additional space after the query to store database name and query cache flags. This space wasn't reserved by the subst_spvars function which led to a memory corruption and crash. Now the subst_spvars function reserves additional space for the query cache. mysql-test/t/query_cache.test: Added a test case for the bug#29856: Insufficient buffer space led to a server crash. mysql-test/r/query_cache.result: Added a test case for the bug#29856: Insufficient buffer space led to a server crash. sql/sp_head.cc: Bug#29856: Insufficient buffer space led to a server crash. Now the subst_spvars function reserves additional space for the query cache. --- mysql-test/r/query_cache.result | 119 ++++++++++++++++++++++++ mysql-test/t/query_cache.test | 124 +++++++++++++++++++++++++ sql/sp_head.cc | 156 +++++++++++++++++--------------- 3 files changed, 327 insertions(+), 72 deletions(-) diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index b0f3fb77c0e..327d9531bc6 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -1467,3 +1467,122 @@ insert into t1 values ('c'); a drop table t1; set GLOBAL query_cache_size= default; +SET GLOBAL query_cache_size=64*1024*1024; +CREATE TABLE t1 (id INT); +CREATE PROCEDURE proc29856(IN theUPC TEXT) +BEGIN +SET @stmtStr := ''; +SELECT CONCAT("SELECT id FROM t1 WHERE id IN (",theUPC,")") INTO @stmtStr; +PREPARE stmt FROM @stmtStr; +EXECUTE stmt; +END | +CALL proc29856('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, +25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50, +51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76, +77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101, +102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120, +121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139, +140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158, +159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177, +178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196, +197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215, +216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234, +235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253, +254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272, +273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291, +292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310, +311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329, +330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348, +349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367, +368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386, +387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405, +406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424, +425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443, +444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462, +463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481, +482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500, +501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519, +520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538, +539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557, +558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576, +577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595, +596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614, +615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633, +634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652, +653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671, +672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690, +691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709, +710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728, +729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747, +748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766, +767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785, +786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804, +805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823, +824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842, +843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861, +862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880, +881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899, +900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918, +919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937, +938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956, +957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975, +976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994, +995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010, +1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025, +1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040, +1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055, +1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070, +1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085, +1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100, +1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115, +1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130, +1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145, +1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160, +1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175, +1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190, +1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205, +1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220, +1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235, +1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250, +1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265, +1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280, +1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295, +1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310, +1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325, +1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340, +1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355, +1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370, +1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385, +1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400, +1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415, +1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430, +1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445, +1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460, +1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475, +1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487,1488,1489,1490, +1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505, +1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520, +1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535, +1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550, +1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565, +1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580, +1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595, +1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610, +1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625, +1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640, +1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655, +1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670, +1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685, +1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,1698,1699,1700, +1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715, +1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727,1728,1729,1730, +1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,1744,1745, +1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760, +1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775, +1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790, +1791,1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805, +1806,1807,1808,1809,1810,1811'); +id +DROP PROCEDURE proc29856; +DROP TABLE t1; +SET GLOBAL query_cache_size= default; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 965ebf5df62..2f4896513f5 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -1028,4 +1028,128 @@ drop table t1; set GLOBAL query_cache_size= default; +# +# Bug#29856: Insufficient buffer space led to a server crash. +# +SET GLOBAL query_cache_size=64*1024*1024; +CREATE TABLE t1 (id INT); +DELIMITER |; +CREATE PROCEDURE proc29856(IN theUPC TEXT) +BEGIN + SET @stmtStr := ''; + SELECT CONCAT("SELECT id FROM t1 WHERE id IN (",theUPC,")") INTO @stmtStr; + PREPARE stmt FROM @stmtStr; + EXECUTE stmt; +END | +DELIMITER ;| +CALL proc29856('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, +25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50, +51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76, +77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101, +102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120, +121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139, +140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158, +159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177, +178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196, +197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215, +216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234, +235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253, +254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272, +273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291, +292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310, +311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329, +330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348, +349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367, +368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386, +387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405, +406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424, +425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443, +444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462, +463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481, +482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500, +501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519, +520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538, +539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557, +558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576, +577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595, +596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614, +615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633, +634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652, +653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671, +672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690, +691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709, +710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728, +729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747, +748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766, +767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785, +786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804, +805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823, +824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842, +843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861, +862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880, +881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899, +900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918, +919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937, +938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956, +957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975, +976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994, +995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010, +1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025, +1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040, +1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055, +1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070, +1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085, +1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100, +1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115, +1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130, +1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145, +1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160, +1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175, +1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190, +1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205, +1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220, +1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235, +1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250, +1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265, +1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280, +1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295, +1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310, +1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325, +1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340, +1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355, +1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370, +1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385, +1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400, +1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415, +1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430, +1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445, +1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460, +1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475, +1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487,1488,1489,1490, +1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505, +1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520, +1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535, +1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550, +1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565, +1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580, +1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595, +1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610, +1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625, +1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640, +1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655, +1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670, +1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685, +1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,1698,1699,1700, +1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715, +1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727,1728,1729,1730, +1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,1744,1745, +1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760, +1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775, +1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790, +1791,1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805, +1806,1807,1808,1809,1810,1811'); +DROP PROCEDURE proc29856; +DROP TABLE t1; +SET GLOBAL query_cache_size= default; + # End of 5.0 tests diff --git a/sql/sp_head.cc b/sql/sp_head.cc index d939fd20b9b..94d3a967b8c 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -767,7 +767,8 @@ int cmp_splocal_locations(Item_splocal * const *a, Item_splocal * const *b) /* - Replace thd->query{_length} with a string that one can write to the binlog. + Replace thd->query{_length} with a string that one can write to the binlog + or the query cache. SYNOPSIS subst_spvars() @@ -779,7 +780,9 @@ int cmp_splocal_locations(Item_splocal * const *a, Item_splocal * const *b) DESCRIPTION The binlog-suitable string is produced by replacing references to SP local - variables with NAME_CONST('sp_var_name', value) calls. + variables with NAME_CONST('sp_var_name', value) calls. To make this string + suitable for the query cache this function allocates some additional space + for the query cache flags. RETURN FALSE on success @@ -792,80 +795,89 @@ static bool subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str) { DBUG_ENTER("subst_spvars"); - if (thd->prelocked_mode == NON_PRELOCKED && mysql_bin_log.is_open()) + + Dynamic_array sp_vars_uses; + char *pbuf, *cur, buffer[512]; + String qbuf(buffer, sizeof(buffer), &my_charset_bin); + int prev_pos, res, buf_len; + + /* Find all instances of Item_splocal used in this statement */ + for (Item *item= instr->free_list; item; item= item->next) { - Dynamic_array sp_vars_uses; - char *pbuf, *cur, buffer[512]; - String qbuf(buffer, sizeof(buffer), &my_charset_bin); - int prev_pos, res; - - /* Find all instances of Item_splocal used in this statement */ - for (Item *item= instr->free_list; item; item= item->next) + if (item->is_splocal()) { - if (item->is_splocal()) - { - Item_splocal *item_spl= (Item_splocal*)item; - if (item_spl->pos_in_query) - sp_vars_uses.append(item_spl); - } + Item_splocal *item_spl= (Item_splocal*)item; + if (item_spl->pos_in_query) + sp_vars_uses.append(item_spl); } - if (!sp_vars_uses.elements()) - DBUG_RETURN(FALSE); - - /* Sort SP var refs by their occurences in the query */ - sp_vars_uses.sort(cmp_splocal_locations); - - /* - Construct a statement string where SP local var refs are replaced - with "NAME_CONST(name, value)" - */ - qbuf.length(0); - cur= query_str->str; - prev_pos= res= 0; - for (Item_splocal **splocal= sp_vars_uses.front(); - splocal < sp_vars_uses.back(); splocal++) - { - Item *val; - - char str_buffer[STRING_BUFFER_USUAL_SIZE]; - String str_value_holder(str_buffer, sizeof(str_buffer), - &my_charset_latin1); - String *str_value; - - /* append the text between sp ref occurences */ - res|= qbuf.append(cur + prev_pos, (*splocal)->pos_in_query - prev_pos); - prev_pos= (*splocal)->pos_in_query + (*splocal)->m_name.length; - - /* append the spvar substitute */ - res|= qbuf.append(STRING_WITH_LEN(" NAME_CONST('")); - res|= qbuf.append((*splocal)->m_name.str, (*splocal)->m_name.length); - res|= qbuf.append(STRING_WITH_LEN("',")); - res|= (*splocal)->fix_fields(thd, (Item **) splocal); - - if (res) - break; - - val= (*splocal)->this_item(); - DBUG_PRINT("info", ("print %p", val)); - str_value= sp_get_item_value(thd, val, &str_value_holder); - if (str_value) - res|= qbuf.append(*str_value); - else - res|= qbuf.append(STRING_WITH_LEN("NULL")); - res|= qbuf.append(')'); - if (res) - break; - } - res|= qbuf.append(cur + prev_pos, query_str->length - prev_pos); - if (res) - DBUG_RETURN(TRUE); - - if (!(pbuf= thd->strmake(qbuf.ptr(), qbuf.length()))) - DBUG_RETURN(TRUE); - - thd->query= pbuf; - thd->query_length= qbuf.length(); } + if (!sp_vars_uses.elements()) + DBUG_RETURN(FALSE); + + /* Sort SP var refs by their occurences in the query */ + sp_vars_uses.sort(cmp_splocal_locations); + + /* + Construct a statement string where SP local var refs are replaced + with "NAME_CONST(name, value)" + */ + qbuf.length(0); + cur= query_str->str; + prev_pos= res= 0; + for (Item_splocal **splocal= sp_vars_uses.front(); + splocal < sp_vars_uses.back(); splocal++) + { + Item *val; + + char str_buffer[STRING_BUFFER_USUAL_SIZE]; + String str_value_holder(str_buffer, sizeof(str_buffer), + &my_charset_latin1); + String *str_value; + + /* append the text between sp ref occurences */ + res|= qbuf.append(cur + prev_pos, (*splocal)->pos_in_query - prev_pos); + prev_pos= (*splocal)->pos_in_query + (*splocal)->m_name.length; + + /* append the spvar substitute */ + res|= qbuf.append(STRING_WITH_LEN(" NAME_CONST('")); + res|= qbuf.append((*splocal)->m_name.str, (*splocal)->m_name.length); + res|= qbuf.append(STRING_WITH_LEN("',")); + res|= (*splocal)->fix_fields(thd, (Item **) splocal); + + if (res) + break; + + val= (*splocal)->this_item(); + DBUG_PRINT("info", ("print %p", val)); + str_value= sp_get_item_value(thd, val, &str_value_holder); + if (str_value) + res|= qbuf.append(*str_value); + else + res|= qbuf.append(STRING_WITH_LEN("NULL")); + res|= qbuf.append(')'); + if (res) + break; + } + res|= qbuf.append(cur + prev_pos, query_str->length - prev_pos); + if (res) + DBUG_RETURN(TRUE); + + /* + Allocate additional space at the end of the new query string for the + query_cache_send_result_to_client function. + */ + buf_len= qbuf.length() + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE + 1; + if ((pbuf= alloc_root(thd->mem_root, buf_len))) + { + memcpy(pbuf, qbuf.ptr(), qbuf.length()); + pbuf[qbuf.length()]= 0; + } + else + DBUG_RETURN(TRUE); + + thd->query= pbuf; + thd->query_length= qbuf.length(); + DBUG_RETURN(FALSE); } From aa4a3c9ad0a1d1c7e1ac036c7ac160a80a051219 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Jul 2007 16:02:29 +0400 Subject: [PATCH 27/49] Bug#30020: Insufficient check led to a wrong info provided by the information schema table. The get_schema_views_record() function fills records in the view table of the informations schema with data about given views. Among other info the is_updatable flag is set. But the check whether the view is updatable or not wasn't covering all cases thus sometimes providing wrong info. This might led to a user confusion. Now the get_schema_views_record function additionally calls to the view->can_be_merge() function to find out whether the view can be updated or not. mysql-test/t/view.test: Added a test case for the bug#30020: Insufficient check led to a wrong info provided by the information schema table. mysql-test/r/view.result: Added a test case for the bug#30020: Insufficient check led to a wrong info provided by the information schema table. sql/sql_show.cc: Bug#30020: Insufficient check led to a wrong info provided by the information schema table. Now the get_schema_views_record function additionally calls to the view->can_be_merge() function to find out whether the view can be updated or not. --- mysql-test/r/view.result | 15 +++++++++++++++ mysql-test/t/view.test | 13 +++++++++++++ sql/sql_show.cc | 4 +++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index c51a4c30960..c5c6b675146 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -3547,4 +3547,19 @@ a b 6 6 DROP VIEW v1; DROP TABLE t1,t2,t3; +create table t1 (i int); +insert into t1 values (1), (2), (1), (3), (2), (4); +create view v1 as select distinct i from t1; +select * from v1; +i +1 +2 +3 +4 +select table_name, is_updatable from information_schema.views +where table_name = 'v1'; +table_name is_updatable +v1 NO +drop view v1; +drop table t1; End of 5.0 tests. diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index c7f722a18a5..fc3fdc932ba 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3402,5 +3402,18 @@ SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6; DROP VIEW v1; DROP TABLE t1,t2,t3; +# +# Bug#30020: Insufficient check led to a wrong info provided by the +# information schema table. +# +create table t1 (i int); +insert into t1 values (1), (2), (1), (3), (2), (4); +create view v1 as select distinct i from t1; +select * from v1; +select table_name, is_updatable from information_schema.views + where table_name = 'v1'; +drop view v1; +drop table t1; + --echo End of 5.0 tests. diff --git a/sql/sql_show.cc b/sql/sql_show.cc index b91412390bc..05a847b3830 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3211,7 +3211,7 @@ static int get_schema_views_record(THD *thd, TABLE_LIST *tables, Item *item; Item_field *field; /* - chech that at least one coulmn in view is updatable + check that at least one column in view is updatable */ while ((item= it++)) { @@ -3222,6 +3222,8 @@ static int get_schema_views_record(THD *thd, TABLE_LIST *tables, break; } } + if (updatable_view && !tables->view->can_be_merged()) + updatable_view= 0; } if (updatable_view) table->field[5]->store(STRING_WITH_LEN("YES"), cs); From 90c5621d6c22ce86354ffe8ccd244007a5e4d846 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Jul 2007 23:10:38 +0500 Subject: [PATCH 28/49] Fixed bug #29834. Using view columns by their names during an execution of a prepared SELECT statement or a SELECT statement inside a SP caused a memory leak. sql/sql_base.cc: Fixed bug #29834. The find_field_in_view function has been modified to use the execution memory root for the Item_direct_view_ref objects allocation at non-first executions of a PS/SP instead of the statement memory. mysql-test/t/sp.test: Updated test case for bug #29834. mysql-test/r/sp.result: Updated test case for bug #29834. --- mysql-test/r/sp.result | 71 ++++++++++++++++++++++++++++++++++++++++ mysql-test/t/sp.test | 74 ++++++++++++++++++++++++++++++++++++++++++ sql/sql_base.cc | 6 ++-- 3 files changed, 148 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index b411c65faee..313fdca7f82 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -1,5 +1,9 @@ use test; drop table if exists t1,t2,t3,t4; +drop view if exists v1; +drop procedure if exists p1; +drop procedure if exists p2; +drop function if exists f1; create table t1 ( id char(16) not null default '', data int not null @@ -6176,4 +6180,71 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI DROP VIEW v1; DROP FUNCTION metered; DROP TABLE t1; +SET @p1_p2_cnt= 2; +CREATE TABLE t1 (c1 INT); +CREATE VIEW v1 AS SELECT * FROM t1; +PREPARE s1 FROM 'SELECT c1 FROM v1'; +EXECUTE s1; +c1 +EXECUTE s1; +c1 +CREATE PROCEDURE p1(IN loops BIGINT(19) UNSIGNED) +BEGIN +WHILE loops > 0 DO +SELECT c1 FROM v1; +SET loops = loops - 1; +END WHILE; +END| +CREATE PROCEDURE p2(IN loops BIGINT(19) UNSIGNED) +BEGIN +WHILE loops > 0 DO +SELECT c1 FROM v1; +CALL p1(@p1_p2_cnt); +SET loops = loops - 1; +END WHILE; +END| +CREATE FUNCTION f1(loops INT UNSIGNED) +RETURNS INT +BEGIN +DECLARE tmp INT; +WHILE loops > 0 DO +SELECT c1 INTO tmp FROM v1; +SET loops = loops - 1; +END WHILE; +RETURN loops; +END| +CALL p1(2); +c1 +c1 +CALL p2(2); +c1 +c1 +c1 +c1 +c1 +c1 +SELECT f1(2); +f1(2) +0 +Warnings: +Warning 1329 No data - zero rows fetched, selected, or processed +Warning 1329 No data - zero rows fetched, selected, or processed +PREPARE s1 FROM 'SELECT f1(2)'; +EXECUTE s1; +f1(2) +0 +Warnings: +Warning 1329 No data - zero rows fetched, selected, or processed +Warning 1329 No data - zero rows fetched, selected, or processed +EXECUTE s1; +f1(2) +0 +Warnings: +Warning 1329 No data - zero rows fetched, selected, or processed +Warning 1329 No data - zero rows fetched, selected, or processed +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP FUNCTION f1; +DROP VIEW v1; +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 2f82482bdf7..088ce9b72ff 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -23,6 +23,10 @@ use test; # --disable_warnings drop table if exists t1,t2,t3,t4; +drop view if exists v1; +drop procedure if exists p1; +drop procedure if exists p2; +drop function if exists f1; --enable_warnings create table t1 ( id char(16) not null default '', @@ -7134,5 +7138,75 @@ DROP VIEW v1; DROP FUNCTION metered; DROP TABLE t1; +# +# Bug#29834: Accessing a view column by name in SP/PS causes a memory leak. +# +# This is leak test. Run with large number assigned to $execute_cnt, +# $p1_cnt, $p2_cnt, @p1_p2_cnt, $f1_normal_cnt or $f1_prep_cnt variables. +# + +let $execute_cnt= 2; +let $p1_cnt= 2; +let $p2_cnt= 2; +SET @p1_p2_cnt= 2; +let $f1_normal_cnt= 2; +let $f1_prep_cnt= 2; + +CREATE TABLE t1 (c1 INT); +CREATE VIEW v1 AS SELECT * FROM t1; + +PREPARE s1 FROM 'SELECT c1 FROM v1'; +while ($execute_cnt) +{ + EXECUTE s1; + dec $execute_cnt; +} + +DELIMITER |; + +CREATE PROCEDURE p1(IN loops BIGINT(19) UNSIGNED) +BEGIN + WHILE loops > 0 DO + SELECT c1 FROM v1; + SET loops = loops - 1; + END WHILE; +END| + +CREATE PROCEDURE p2(IN loops BIGINT(19) UNSIGNED) +BEGIN + WHILE loops > 0 DO + SELECT c1 FROM v1; + CALL p1(@p1_p2_cnt); + SET loops = loops - 1; + END WHILE; +END| + +CREATE FUNCTION f1(loops INT UNSIGNED) + RETURNS INT +BEGIN + DECLARE tmp INT; + WHILE loops > 0 DO + SELECT c1 INTO tmp FROM v1; + SET loops = loops - 1; + END WHILE; + RETURN loops; +END| + +DELIMITER ;| + +eval CALL p1($p1_cnt); +eval CALL p2($p2_cnt); + +eval SELECT f1($f1_normal_cnt); + +eval PREPARE s1 FROM 'SELECT f1($f1_prep_cnt)'; +EXECUTE s1; +EXECUTE s1; + +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP FUNCTION f1; +DROP VIEW v1; +DROP TABLE t1; --echo End of 5.0 tests diff --git a/sql/sql_base.cc b/sql/sql_base.cc index ed006714143..deb46f0d932 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3435,7 +3435,7 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list, table_list->alias, name, item_name, (ulong) ref)); Field_iterator_view field_it; field_it.set(table_list); - Query_arena *arena, backup; + Query_arena *arena= 0, backup; DBUG_ASSERT(table_list->schema_table_reformed || (ref != 0 && table_list->view != 0)); @@ -3444,14 +3444,14 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list, if (!my_strcasecmp(system_charset_info, field_it.name(), name)) { // in PS use own arena or data will be freed after prepare - if (register_tree_change) + if (register_tree_change && thd->stmt_arena->is_stmt_prepare_or_first_sp_execute()) arena= thd->activate_stmt_arena_if_needed(&backup); /* create_item() may, or may not create a new Item, depending on the column reference. See create_view_field() for details. */ Item *item= field_it.create_item(thd); - if (register_tree_change && arena) + if (arena) thd->restore_active_arena(arena, &backup); if (!item) From 151e6aba09c20314c13a410b3c90cb79c1701fce Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 29 Jul 2007 14:05:03 +0200 Subject: [PATCH 29/49] Clean up patch - Removed unused variable. sql/sql_lex.cc: - Removed unused variable --- sql/sql_lex.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 106dcf88a84..a62d8b383a5 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -2059,8 +2059,6 @@ void st_select_lex_unit::set_limit(SELECT_LEX *sl) void st_lex::set_trg_event_type_for_tables() { - enum trg_event_type trg_event; - uint8 new_trg_event_map= 0; /* From 33fc4ad4e124413ef617a1a073bb50135f6a12af Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 Jul 2007 04:35:16 +0500 Subject: [PATCH 30/49] Fixed bug #30120. SP with local variables with non-ASCII names crashed the server. The server replaces SP local variable names with NAME_CONST calls when putting statements into the binary log. It used UTF8-encoded item names as variable names for the replacement inside NAME_CONST calls. However, statement string may be encoded by any known character set by the SET NAMES statement. The server used byte length of UTF8-encoded names to increment the position in the query string that led to array index overrun. sql/item.cc: Fixed bug #30120. The Item_splocal class constructor has been modified to accept new parameter `len_in_q': the byte length of variable name in the query string. sql/item.h: Fixed bug #30120. The Item_splocal class has been modified to keep new field `len_in_query': the byte length of variable name in the query string. sql/sp_head.cc: Fixed bug #30120. The subst_spvars function has been modified to increment position in the query string by the lengths of not encoded variable names instead of byte length of names encoded to UTF-8. sql/sql_yacc.yy: Fixed bug #30120. The simple_ident rule action has been modified to pass the byte length of the local variable name token to the Item_splocal object constructor. mysql-test/t/sp.test: Updated test case for bug #30120. mysql-test/r/sp.result: Updated test case for bug #30120. --- mysql-test/r/sp.result | 11 +++++++++++ mysql-test/t/sp.test | 21 +++++++++++++++++++++ sql/item.cc | 4 ++-- sql/item.h | 11 ++++++++++- sql/sp_head.cc | 2 +- sql/sql_yacc.yy | 3 ++- 6 files changed, 47 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index a7b6d8aa3fd..4a278cd4aec 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -6303,4 +6303,15 @@ DROP VIEW v1; DROP FUNCTION f1; DROP FUNCTION f2; DROP TABLE t1; +SET NAMES latin1; +CREATE PROCEDURE p1() +BEGIN +DECLARE áâä INT; +SELECT áâä; +END| +CALL p1(); +áâä +NULL +SET NAMES default; +DROP PROCEDURE p1; End of 5.0 tests diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index ddf33b285f5..46a1b1dc740 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -7278,4 +7278,25 @@ DROP FUNCTION f1; DROP FUNCTION f2; DROP TABLE t1; +# +# Bug #30120 SP with local variables with non-ASCII names crashes server. +# + +SET NAMES latin1; + +DELIMITER |; + +CREATE PROCEDURE p1() +BEGIN + DECLARE áâä INT; + SELECT áâä; +END| + +DELIMITER ;| + +CALL p1(); + +SET NAMES default; +DROP PROCEDURE p1; + --echo End of 5.0 tests diff --git a/sql/item.cc b/sql/item.cc index bd47fb706a6..9612fbc5243 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1053,9 +1053,9 @@ bool Item_sp_variable::is_null() Item_splocal::Item_splocal(const LEX_STRING &sp_var_name, uint sp_var_idx, enum_field_types sp_var_type, - uint pos_in_q) + uint pos_in_q, uint len_in_q) :Item_sp_variable(sp_var_name.str, sp_var_name.length), - m_var_idx(sp_var_idx), pos_in_query(pos_in_q) + m_var_idx(sp_var_idx), pos_in_query(pos_in_q), len_in_query(len_in_q) { maybe_null= TRUE; diff --git a/sql/item.h b/sql/item.h index 72236cb5e63..23f6977a0f8 100644 --- a/sql/item.h +++ b/sql/item.h @@ -960,9 +960,18 @@ public: SP variable in query text. */ uint pos_in_query; + /* + Byte length of SP variable name in the statement (see pos_in_query). + The value of this field may differ from the name_length value because + name_length contains byte length of UTF8-encoded item name, but + the query string (see sp_instr_stmt::m_query) is currently stored with + a charset from the SET NAMES statement. + */ + uint len_in_query; Item_splocal(const LEX_STRING &sp_var_name, uint sp_var_idx, - enum_field_types sp_var_type, uint pos_in_q= 0); + enum_field_types sp_var_type, + uint pos_in_q= 0, uint len_in_q= 0); bool is_splocal() { return 1; } /* Needed for error checking */ diff --git a/sql/sp_head.cc b/sql/sp_head.cc index fd8724b2171..8f4d407a5b0 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -864,7 +864,7 @@ subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str) /* append the text between sp ref occurences */ res|= qbuf.append(cur + prev_pos, (*splocal)->pos_in_query - prev_pos); - prev_pos= (*splocal)->pos_in_query + (*splocal)->m_name.length; + prev_pos= (*splocal)->pos_in_query + (*splocal)->len_in_query; /* append the spvar substitute */ res|= qbuf.append(STRING_WITH_LEN(" NAME_CONST('")); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 6fbd521e302..b0e59d0f8dc 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -7708,7 +7708,8 @@ simple_ident: Item_splocal *splocal; splocal= new Item_splocal($1, spv->offset, spv->type, lip->tok_start_prev - - lex->sphead->m_tmp_query); + lex->sphead->m_tmp_query, + lip->tok_end - lip->tok_start_prev); #ifndef DBUG_OFF if (splocal) splocal->m_sp= lex->sphead; From eb6c85e7552dcf63f2b2ed065051f571425d8426 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 Jul 2007 14:22:29 +0400 Subject: [PATCH 31/49] Fix a compilation warning. sql/handler.h: Fix a warning. --- sql/handler.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/handler.h b/sql/handler.h index cd9f9a91008..2caf9b20945 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -624,7 +624,6 @@ public: int ha_external_lock(THD *thd, int lock_type) { - int rc; DBUG_ENTER("ha_external_lock"); locked= lock_type != F_UNLCK; DBUG_RETURN(external_lock(thd, lock_type)); From b9097abf00983f479f8e4b9f0ee82ac7fde74adc Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 Jul 2007 16:03:52 +0300 Subject: [PATCH 32/49] Moved the DBUG_ASSERT from bug 28983 to a place where it would not obstruct correct multithreading. --- sql/log.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/log.cc b/sql/log.cc index 744d2a3ca65..6992f6c10ef 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1833,6 +1833,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event) /* NULL would represent nothing to replicate after ROLLBACK */ DBUG_ASSERT(commit_event != NULL); + DBUG_ASSERT(is_open()); if (likely(is_open())) // Should always be true { uint length, group, carry, hdr_offs, val; From 9246c3720103caa421d5e0c5d7ad81bf570e071d Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 Jul 2007 17:14:34 +0400 Subject: [PATCH 33/49] Bug#24989: The DEADLOCK error is improperly handled by InnoDB. When innodb detects a deadlock it calls ha_rollback_trans() to rollback the main transaction. But such action isn't allowed from inside of triggers and functions. When it happen the 'Explicit or implicit commit' error is thrown even if there is no commit/rollback statements in the trigger/function. This leads to the user confusion. Now the convert_error_code_to_mysql() function doesn't call the ha_rollback_trans() function directly but rather calls the mark_transaction_to_rollback function and returns an error. The sp_rcontext::find_handler() now doesn't allow errors to be caught by the trigger/function error handlers when the thd->is_fatal_sub_stmt_error flag is set. Procedures are still allowed to catch such errors. The sp_rcontext::find_handler function now accepts a THD handle as a parameter. The transaction_rollback_request and the is_fatal_sub_stmt_error flags are added to the THD class. The are initialized by the THD class constructor. Now the ha_autocommit_or_rollback function rolls back main transaction when not in a sub statement and the thd->transaction_rollback_request is set. The THD::restore_sub_statement_state function now resets the thd->is_fatal_sub_stmt_error flag on exit from a sub-statement. sql/ha_innodb.cc: Bug#24989: The DEADLOCK error is improperly handled by InnoDB. Now the convert_error_code_to_mysql() function doesn't call the ha_rollback_trans() function directly but rather calls the mark_transaction_to_rollback function and returns an error. sql/handler.cc: Bug#24989: The DEADLOCK error is improperly handled by InnoDB. Now the ha_autocommit_or_rollback function rolls back main transaction when not in a sub statement and the thd->transaction_rollback_request is set. mysql-test/r/innodb-big.result: Added a test case for the bug#24989: The DEADLOCK error is improperly handled by InnoDB. mysql-test/t/innodb-big.test: Added a test case for the bug#24989: The DEADLOCK error is improperly handled by InnoDB. sql/sql_class.h: Bug#24989: The DEADLOCK error is improperly handled by InnoDB. The transaction_rollback_request and the is_fatal_sub_stmt_error flags are added to the THD class. sql/sql_class.cc: Bug#24989: The DEADLOCK error is improperly handled by InnoDB. Initialization of the transaction_rollback_request and the is_fatal_sub_stmt_error flags are added to the THD class constructor. The mark_transaction_to_rollback function is added. The THD::restore_sub_statement_state function now resets the thd->is_fatal_sub_stmt_error flag on exit from a sub-statement. sql/sp_rcontext.h: Bug#24989: The DEADLOCK error is improperly handled by InnoDB. The sp_rcontext::find_handler function now accepts a THD handle as a parameter. The in_sub_stmt flag is added to the sp_rcontext class. sql/sp_rcontext.cc: Bug#24989: The DEADLOCK error is improperly handled by InnoDB. The sp_rcontext::find_handler() now doesn't allow errors to be caught by the trigger/function error handlers when the thd->is_fatal_sub_stmt_error flag is set. Instead it tries to find a most inner procedure that isn't called directly or indirectly from any function/trigger. Procedures are still allowed to catch such errors. The sp_rcontext::find_handler function now accepts a THD handle as a parameter. --- mysql-test/r/innodb-big.result | 66 ++++++++++++++++++++ mysql-test/t/innodb-big.test | 106 +++++++++++++++++++++++++++++++++ sql/ha_innodb.cc | 12 +--- sql/handler.cc | 5 ++ sql/sp_rcontext.cc | 18 +++++- sql/sp_rcontext.h | 6 +- sql/sql_class.cc | 22 ++++++- sql/sql_class.h | 30 +++++++++- 8 files changed, 250 insertions(+), 15 deletions(-) diff --git a/mysql-test/r/innodb-big.result b/mysql-test/r/innodb-big.result index 19204b7cc65..84bb02d445e 100644 --- a/mysql-test/r/innodb-big.result +++ b/mysql-test/r/innodb-big.result @@ -32,3 +32,69 @@ select sum(id) from t3; sum(id) 2199024304128 drop table t1,t2,t3,t4; +CREATE TABLE t1 (f1 int NOT NULL) ENGINE=InnoDB; +CREATE TABLE t2 (f2 int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +CREATE TRIGGER t1_bi before INSERT +ON t1 FOR EACH ROW +BEGIN +DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @a:= 'deadlock'; +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception'; +INSERT INTO t2 (f2) VALUES (1); +DELETE FROM t2 WHERE f2 = 1; +END;| +CREATE PROCEDURE proc24989() +BEGIN +DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @b:= 'deadlock'; +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception'; +INSERT INTO t2 (f2) VALUES (1); +DELETE FROM t2 WHERE f2 = 1; +END;| +create procedure proc24989_2() +deterministic +begin +declare continue handler for sqlexception +select 'Outer handler' as 'exception'; +insert into t1 values(1); +select "continued"; +end| +start transaction; +insert into t1 values(1); +start transaction; +insert into t2 values(123); +insert into t1 values(1); +insert into t1 values(1); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +select @a; +@a +NULL +select * from t2; +f2 +commit; +start transaction; +insert into t1 values(1); +start transaction; +insert into t2 values(123); +call proc24989(); +insert into t1 values(1); +select @a,@b; +@a @b +exception deadlock +select * from t2; +f2 +commit; +start transaction; +insert into t1 values(1); +start transaction; +insert into t2 values(123); +call proc24989_2(); +insert into t1 values(1); +commit; +exception +Outer handler +continued +continued +select * from t2; +f2 +drop procedure proc24989; +drop procedure proc24989_2; +drop table t1,t2; diff --git a/mysql-test/t/innodb-big.test b/mysql-test/t/innodb-big.test index ade69ffdb45..dcb32cd8e71 100644 --- a/mysql-test/t/innodb-big.test +++ b/mysql-test/t/innodb-big.test @@ -44,3 +44,109 @@ INSERT INTO t3 SELECT concat(id),id from t2 ORDER BY -id; INSERT INTO t4 SELECT * from t3 ORDER BY concat(a); select sum(id) from t3; drop table t1,t2,t3,t4; + +# +# Bug#24989: The DEADLOCK error is improperly handled by InnoDB. +# +CREATE TABLE t1 (f1 int NOT NULL) ENGINE=InnoDB; +CREATE TABLE t2 (f2 int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +DELIMITER |; +CREATE TRIGGER t1_bi before INSERT + ON t1 FOR EACH ROW +BEGIN + DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @a:= 'deadlock'; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception'; + INSERT INTO t2 (f2) VALUES (1); + DELETE FROM t2 WHERE f2 = 1; +END;| + +CREATE PROCEDURE proc24989() +BEGIN + DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @b:= 'deadlock'; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception'; + INSERT INTO t2 (f2) VALUES (1); + DELETE FROM t2 WHERE f2 = 1; +END;| + +create procedure proc24989_2() + deterministic +begin + declare continue handler for sqlexception + select 'Outer handler' as 'exception'; + + insert into t1 values(1); + select "continued"; +end| + +DELIMITER ;| + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); + +connection con1; +start transaction; +insert into t1 values(1); + +connection con2; +start transaction; +insert into t2 values(123); +send insert into t1 values(1); + +connection con1; +--sleep 1 +insert into t1 values(1); + +connection con2; +--error 1213 +reap; +select @a; +# check that the whole transaction was rolled back +select * from t2; + +connection con1; +commit; +start transaction; +insert into t1 values(1); + +connection con2; +start transaction; +insert into t2 values(123); +send call proc24989(); + +connection con1; +--sleep 1 +insert into t1 values(1); + +connection con2; +reap; +select @a,@b; +# check that the whole transaction was rolled back +select * from t2; + +connection con1; +commit; +start transaction; +insert into t1 values(1); + +connection con2; +start transaction; +insert into t2 values(123); +send call proc24989_2(); + +connection con1; +--sleep 1 +insert into t1 values(1); +commit; + +connection con2; +reap; +# check that the whole transaction was rolled back +select * from t2; + +disconnect con1; +disconnect con2; +connection default; +drop procedure proc24989; +drop procedure proc24989_2; +drop table t1,t2; + diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 455c0968050..d4a43dc4297 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -455,9 +455,7 @@ convert_error_code_to_mysql( tell it also to MySQL so that MySQL knows to empty the cached binlog for this transaction */ - if (thd) { - ha_rollback(thd); - } + mark_transaction_to_rollback(thd, TRUE); return(HA_ERR_LOCK_DEADLOCK); @@ -467,9 +465,7 @@ convert_error_code_to_mysql( latest SQL statement in a lock wait timeout. Previously, we rolled back the whole transaction. */ - if (thd && row_rollback_on_timeout) { - ha_rollback(thd); - } + mark_transaction_to_rollback(thd, row_rollback_on_timeout); return(HA_ERR_LOCK_WAIT_TIMEOUT); @@ -521,9 +517,7 @@ convert_error_code_to_mysql( tell it also to MySQL so that MySQL knows to empty the cached binlog for this transaction */ - if (thd) { - ha_rollback(thd); - } + mark_transaction_to_rollback(thd, TRUE); return(HA_ERR_LOCK_TABLE_FULL); } else { diff --git a/sql/handler.cc b/sql/handler.cc index 867ac7ff778..e4a5e65b80c 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -821,6 +821,9 @@ int ha_rollback_trans(THD *thd, bool all) } } #endif /* USING_TRANSACTIONS */ + if (all) + thd->transaction_rollback_request= FALSE; + /* If a non-transactional table was updated, warn; don't warn if this is a slave thread (because when a slave thread executes a ROLLBACK, it has @@ -858,6 +861,8 @@ int ha_autocommit_or_rollback(THD *thd, int error) if (ha_commit_stmt(thd)) error=1; } + else if (thd->transaction_rollback_request && !thd->in_sub_stmt) + (void) ha_rollback(thd); else (void) ha_rollback_stmt(thd); diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index e49c4eb1240..ac7c46c9fe5 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -37,6 +37,7 @@ sp_rcontext::sp_rcontext(sp_pcontext *root_parsing_ctx, m_var_items(0), m_return_value_fld(return_value_fld), m_return_value_set(FALSE), + in_sub_stmt(FALSE), m_hcount(0), m_hsp(0), m_ihsp(0), @@ -67,6 +68,8 @@ sp_rcontext::~sp_rcontext() bool sp_rcontext::init(THD *thd) { + in_sub_stmt= thd->in_sub_stmt; + if (init_var_table(thd) || init_var_items()) return TRUE; @@ -191,7 +194,7 @@ sp_rcontext::set_return_value(THD *thd, Item **return_value_item) */ bool -sp_rcontext::find_handler(uint sql_errno, +sp_rcontext::find_handler(THD *thd, uint sql_errno, MYSQL_ERROR::enum_warning_level level) { if (m_hfound >= 0) @@ -200,6 +203,15 @@ sp_rcontext::find_handler(uint sql_errno, const char *sqlstate= mysql_errno_to_sqlstate(sql_errno); int i= m_hcount, found= -1; + /* + If this is a fatal sub-statement error, and this runtime + context corresponds to a sub-statement, no CONTINUE/EXIT + handlers from this context are applicable: try to locate one + in the outer scope. + */ + if (thd->is_fatal_sub_stmt_error && in_sub_stmt) + i= 0; + /* Search handlers from the latest (innermost) to the oldest (outermost) */ while (i--) { @@ -252,7 +264,7 @@ sp_rcontext::find_handler(uint sql_errno, */ if (m_prev_runtime_ctx && IS_EXCEPTION_CONDITION(sqlstate) && level == MYSQL_ERROR::WARN_LEVEL_ERROR) - return m_prev_runtime_ctx->find_handler(sql_errno, level); + return m_prev_runtime_ctx->find_handler(thd, sql_errno, level); return FALSE; } m_hfound= found; @@ -298,7 +310,7 @@ sp_rcontext::handle_error(uint sql_errno, elevated_level= MYSQL_ERROR::WARN_LEVEL_ERROR; } - if (find_handler(sql_errno, elevated_level)) + if (find_handler(thd, sql_errno, elevated_level)) { if (elevated_level == MYSQL_ERROR::WARN_LEVEL_ERROR) { diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h index fbf479f52aa..0104b71a648 100644 --- a/sql/sp_rcontext.h +++ b/sql/sp_rcontext.h @@ -125,7 +125,7 @@ class sp_rcontext : public Sql_alloc // Returns 1 if a handler was found, 0 otherwise. bool - find_handler(uint sql_errno,MYSQL_ERROR::enum_warning_level level); + find_handler(THD *thd, uint sql_errno,MYSQL_ERROR::enum_warning_level level); // If there is an error handler for this error, handle it and return TRUE. bool @@ -236,6 +236,10 @@ private: during execution. */ bool m_return_value_set; + /** + TRUE if the context is created for a sub-statement. + */ + bool in_sub_stmt; sp_handler_t *m_handler; // Visible handlers uint m_hcount; // Stack pointer for m_handler diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 010dc101e0d..33286e814aa 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -173,6 +173,7 @@ THD::THD() Open_tables_state(refresh_version), lock_id(&main_lock_id), user_time(0), in_sub_stmt(0), global_read_lock(0), is_fatal_error(0), + transaction_rollback_request(0), is_fatal_sub_stmt_error(0), rand_used(0), time_zone_used(0), last_insert_id_used(0), last_insert_id_used_bin_log(0), insert_id_used(0), clear_next_insert_id(0), in_lock_tables(0), bootstrap(0), @@ -967,7 +968,7 @@ void select_send::abort() { DBUG_ENTER("select_send::abort"); if (status && thd->spcont && - thd->spcont->find_handler(thd->net.last_errno, + thd->spcont->find_handler(thd, thd->net.last_errno, MYSQL_ERROR::WARN_LEVEL_ERROR)) { /* @@ -2150,6 +2151,13 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup) limit_found_rows= backup->limit_found_rows; sent_row_count= backup->sent_row_count; client_capabilities= backup->client_capabilities; + /* + If we've left sub-statement mode, reset the fatal error flag. + Otherwise keep the current value, to propagate it up the sub-statement + stack. + */ + if (!in_sub_stmt) + is_fatal_sub_stmt_error= FALSE; if ((options & OPTION_BIN_LOG) && is_update_query(lex->sql_command)) mysql_bin_log.stop_union_events(this); @@ -2163,6 +2171,18 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup) } +/** + Mark transaction to rollback and mark error as fatal to a sub-statement. + + @param thd Thread handle + @param all TRUE <=> rollback main transaction. +*/ + +void mark_transaction_to_rollback(THD *thd, bool all) +{ + thd->is_fatal_sub_stmt_error= TRUE; + thd->transaction_rollback_request= all; +} /*************************************************************************** Handling of XA id cacheing ***************************************************************************/ diff --git a/sql/sql_class.h b/sql/sql_class.h index 5f813e82307..674409d6f08 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1406,7 +1406,33 @@ public: bool slave_thread, one_shot_set; bool locked, some_tables_deleted; bool last_cuted_field; - bool no_errors, password, is_fatal_error; + bool no_errors, password; + /** + Set to TRUE if execution of the current compound statement + can not continue. In particular, disables activation of + CONTINUE or EXIT handlers of stored routines. + Reset in the end of processing of the current user request, in + @see mysql_reset_thd_for_next_command(). + */ + bool is_fatal_error; + /** + Set by a storage engine to request the entire + transaction (that possibly spans multiple engines) to + rollback. Reset in ha_rollback. + */ + bool transaction_rollback_request; + /** + TRUE if we are in a sub-statement and the current error can + not be safely recovered until we left the sub-statement mode. + In particular, disables activation of CONTINUE and EXIT + handlers inside sub-statements. E.g. if it is a deadlock + error and requires a transaction-wide rollback, this flag is + raised (traditionally, MySQL first has to close all the reads + via @see handler::ha_index_or_rnd_end() and only then perform + the rollback). + Reset to FALSE when we leave the sub-statement mode. + */ + bool is_fatal_sub_stmt_error; bool query_start_used, rand_used, time_zone_used; /* @@ -2338,3 +2364,5 @@ public: /* Functions in sql_class.cc */ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var); +void mark_transaction_to_rollback(THD *thd, bool all); + From 1307d3b8033985d842b900ec8ebe7be9f0a4e092 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 Jul 2007 18:27:36 +0300 Subject: [PATCH 34/49] (pushing for Andrei) Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack Once had been set the flag might later got reset inside of a stored routine execution stack. The reason was in that there was no check if a new statement started at time of resetting. The artifact affects most of binlogable DML queries. Notice, that multi-update is wrapped up within bug@27716 fix, multi-delete bug@29136. Fixed with saving parent's statement flag of whether the statement modified non-transactional table, and unioning (merging) the value with that was gained in mysql_execute_command. Resettling thd->no_trans_update members into thd->transaction.`member`; Asserting code; Effectively the following properties are held. 1. At the end of a substatement thd->transaction.stmt.modified_non_trans_table reflects the fact if such a table got modified by the substatement. That also respects THD::really_abort_on_warnin() requirements. 2. Eventually thd->transaction.stmt.modified_non_trans_table will be computed as the union of the values of all invoked sub-statements. That fixes this bug#27417; Computing of thd->transaction.all.modified_non_trans_table is refined to base to the stmt's value for all the case including insert .. select statement which before the patch had an extra issue bug@28960. Minor issues are covered with mysql_load, mysql_delete, and binloggin of insert in to temp_table select. The supplied test verifies limitely, mostly asserts. The ultimate testing is defered for bug@13270, bug@23333. mysql-test/r/mix_innodb_myisam_binlog.result: results changed mysql-test/t/mix_innodb_myisam_binlog.test: regression test incl the related bug#28960. sql/ha_ndbcluster.cc: thd->transaction.{all,stmt}.modified_non_trans_table instead of thd->no_trans_update.{all,stmt} sql/handler.cc: thd->transaction.{all,stmt}.modified_non_trans_table instead of thd->no_trans_update.{all,stmt} sql/handler.h: new member added sql/log.cc: thd->transaction.{all,stmt}.modified_non_trans_table instead of thd->no_trans_update.{all,stmt} sql/set_var.cc: thd->transaction.{all,stmt}.modified_non_trans_table instead of thd->no_trans_update.{all,stmt} sql/sp_head.cc: thd->transaction.{all,stmt}.modified_non_trans_table instead of thd->no_trans_update.{all,stmt} and saving and merging stmt's flag at the end of a substatement. sql/sql_class.cc: thd->transaction.{all,stmt}.modified_non_trans_table instead of thd->no_trans_update.{all,stmt} sql/sql_class.h: thd->transaction.{all,stmt}.modified_non_trans_table instead of thd->no_trans_update.{all,stmt} sql/sql_delete.cc: correcting basic delete incl truncate branch and multi-delete queries to set stmt.modified_non_trans_table; optimization to set the flag at the end of per-row loop; multi-delete still has an extra issue similar to bug#27716 of multi-update - to be address with bug_29136 fix. sql/sql_insert.cc: thd->transaction.{all,stmt}.modified_non_trans_table instead of thd->no_trans_update.{all,stmt} sql/sql_load.cc: eliminating a separate issue where the stmt flag was saved and re-stored after write_record that actually could change it and the change would be lost but should remain permanent; thd->transaction.{all,stmt}.modified_non_trans_table instead of thd->no_trans_update.{all,stmt} sql/sql_parse.cc: initialization to transaction.stmt.modified_non_trans_table at the common part of all types of statements processing - mysql_execute_command(). sql/sql_table.cc: moving the reset up to the mysql_execute_command() caller sql/sql_update.cc: correcting update query case (multi-update part of the issues covered by other bug#27716 fix) thd->transaction.{all,stmt}.modified_non_trans_table instead of thd->no_trans_update.{all,stmt} --- mysql-test/r/mix_innodb_myisam_binlog.result | 113 +++++++++++++++++ mysql-test/t/mix_innodb_myisam_binlog.test | 122 ++++++++++++++++++- sql/ha_ndbcluster.cc | 2 +- sql/handler.cc | 2 +- sql/handler.h | 29 +++++ sql/log.cc | 4 +- sql/set_var.cc | 4 +- sql/sp_head.cc | 20 ++- sql/sql_class.cc | 2 +- sql/sql_class.h | 6 +- sql/sql_delete.cc | 31 +++-- sql/sql_insert.cc | 43 ++++--- sql/sql_load.cc | 16 +-- sql/sql_parse.cc | 22 ++-- sql/sql_table.cc | 1 - sql/sql_update.cc | 41 +++---- 16 files changed, 368 insertions(+), 90 deletions(-) diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result index 8fc5bfca3ef..5777bd890b2 100644 --- a/mysql-test/r/mix_innodb_myisam_binlog.result +++ b/mysql-test/r/mix_innodb_myisam_binlog.result @@ -280,3 +280,116 @@ select @a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" 1 1 drop table t1, t2; +create temporary table tt (a int unique); +create table ti (a int) engine=innodb; +reset master; +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 98 +begin; +insert into ti values (1); +insert into ti values (2) ; +insert into tt select * from ti; +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +select count(*) from tt /* 2 */; +count(*) +2 +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 507 +show binlog events from 98; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; BEGIN +master-bin.000001 # Query 1 # use `test`; insert into ti values (1) +master-bin.000001 # Query 1 # use `test`; insert into ti values (2) +master-bin.000001 # Query 1 # use `test`; insert into tt select * from ti +master-bin.000001 # Query 1 # use `test`; ROLLBACK +select count(*) from ti /* zero */; +count(*) +0 +insert into ti select * from tt; +select * from ti /* that is what slave would miss - a bug */; +a +1 +2 +delete from ti; +delete from tt where a=1; +reset master; +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 98 +begin; +insert into ti values (1); +insert into ti values (2) /* to make the dup error in the following */; +insert into tt select * from ti /* one affected and error */; +ERROR 23000: Duplicate entry '2' for key 1 +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 581 +show binlog events from 98; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; BEGIN +master-bin.000001 # Query 1 # use `test`; insert into ti values (1) +master-bin.000001 # Query 1 # use `test`; insert into ti values (2) /* to make the dup error in the following */ +master-bin.000001 # Query 1 # use `test`; insert into tt select * from ti /* one affected and error */ +master-bin.000001 # Query 1 # use `test`; ROLLBACK +select count(*) from ti /* zero */; +count(*) +0 +insert into ti select * from tt; +select * from tt /* that is what otherwise slave missed - the bug */; +a +1 +2 +drop table ti; +drop function if exists bug27417; +drop table if exists t1,t2; +CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; +CREATE TABLE t2 (a int NOT NULL auto_increment, PRIMARY KEY (a)); +create function bug27417(n int) +RETURNS int(11) +begin +insert into t1 values (null); +return n; +end| +reset master; +insert into t2 values (bug27417(1)); +insert into t2 select bug27417(2); +reset master; +insert into t2 values (bug27417(2)); +ERROR 23000: Duplicate entry '2' for key 1 +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 98 +/* only (!) with fixes for #23333 will show there is the query */; +select count(*) from t1 /* must be 3 */; +count(*) +3 +reset master; +select count(*) from t2; +count(*) +2 +delete from t2 where a=bug27417(3); +select count(*) from t2 /* nothing got deleted */; +count(*) +2 +show master status; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 195 +/* the query must be in regardless of #23333 */; +select count(*) from t1 /* must be 5 */; +count(*) +5 +delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; +affected rows: 0 +select count(*) from t1 /* must be 7 */; +count(*) +7 +drop function bug27417; +drop table t1,t2; +end of tests diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test index 428aba92342..f9d7235ff84 100644 --- a/mysql-test/t/mix_innodb_myisam_binlog.test +++ b/mysql-test/t/mix_innodb_myisam_binlog.test @@ -233,8 +233,6 @@ source include/show_binlog_events.inc; do release_lock("lock1"); drop table t0,t2; -# End of 4.1 tests - # Test for BUG#16559 (ROLLBACK should always have a zero error code in # binlog). Has to be here and not earlier, as the SELECTs influence # XIDs differently between normal and ps-protocol (and SHOW BINLOG @@ -267,3 +265,123 @@ eval select @a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; drop table t1, t2; + +# +# Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack +# bug #28960 non-trans temp table changes with insert .. select +# not binlogged after rollback +# +# testing appearence of insert into temp_table in binlog. +# There are two branches of execution that require different setup. + +## send_eof() branch + +# prepare + +create temporary table tt (a int unique); +create table ti (a int) engine=innodb; +reset master; +show master status; + +# action + +begin; +insert into ti values (1); +insert into ti values (2) ; +insert into tt select * from ti; +rollback; + +# check + +select count(*) from tt /* 2 */; +show master status; +--replace_column 2 # 5 # +show binlog events from 98; +select count(*) from ti /* zero */; +insert into ti select * from tt; +select * from ti /* that is what slave would miss - a bug */; + + +## send_error() branch +delete from ti; +delete from tt where a=1; +reset master; +show master status; + +# action + +begin; +insert into ti values (1); +insert into ti values (2) /* to make the dup error in the following */; +--error ER_DUP_ENTRY +insert into tt select * from ti /* one affected and error */; +rollback; + +# check + +show master status; +--replace_column 2 # 5 # +show binlog events from 98; +select count(*) from ti /* zero */; +insert into ti select * from tt; +select * from tt /* that is what otherwise slave missed - the bug */; + +drop table ti; + + +# +# Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack +# +# Testing asserts: if there is a side effect of modifying non-transactional +# table thd->no_trans_update.stmt must be TRUE; +# the assert is active with debug build +# + +--disable_warnings +drop function if exists bug27417; +drop table if exists t1,t2; +--enable_warnings +# side effect table +CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM; +# target tables +CREATE TABLE t2 (a int NOT NULL auto_increment, PRIMARY KEY (a)); + +delimiter |; +create function bug27417(n int) +RETURNS int(11) +begin + insert into t1 values (null); + return n; +end| +delimiter ;| + +reset master; + +# execute + +insert into t2 values (bug27417(1)); +insert into t2 select bug27417(2); +reset master; + +--error ER_DUP_ENTRY +insert into t2 values (bug27417(2)); +show master status; /* only (!) with fixes for #23333 will show there is the query */; +select count(*) from t1 /* must be 3 */; + +reset master; +select count(*) from t2; +delete from t2 where a=bug27417(3); +select count(*) from t2 /* nothing got deleted */; +show master status; /* the query must be in regardless of #23333 */; +select count(*) from t1 /* must be 5 */; + +--enable_info +delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; +--disable_info +select count(*) from t1 /* must be 7 */; + +drop function bug27417; +drop table t1,t2; + +--echo end of tests + diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 357b797ec75..a00dd6c505c 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -3732,7 +3732,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) { m_transaction_on= FALSE; /* Would be simpler if has_transactions() didn't always say "yes" */ - thd->no_trans_update.all= thd->no_trans_update.stmt= TRUE; + thd->transaction.all.modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table= TRUE; } else if (!thd->transaction.on) m_transaction_on= FALSE; diff --git a/sql/handler.cc b/sql/handler.cc index dcc9fde8b76..7b8625f6b3a 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -830,7 +830,7 @@ int ha_rollback_trans(THD *thd, bool all) the error log; but we don't want users to wonder why they have this message in the error log, so we don't send it. */ - if (is_real_trans && thd->no_trans_update.all && + if (is_real_trans && thd->transaction.all.modified_non_trans_table && !thd->slave_thread) push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARNING_NOT_COMPLETE_ROLLBACK, diff --git a/sql/handler.h b/sql/handler.h index a3767573178..c44d7c7f846 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -420,6 +420,35 @@ typedef struct st_thd_trans bool no_2pc; /* storage engines that registered themselves for this transaction */ handlerton *ht[MAX_HA]; + /* + The purpose of this flag is to keep track of non-transactional + tables that were modified in scope of: + - transaction, when the variable is a member of + THD::transaction.all + - top-level statement or sub-statement, when the variable is a + member of THD::transaction.stmt + This member has the following life cycle: + * stmt.modified_non_trans_table is used to keep track of + modified non-transactional tables of top-level statements. At + the end of the previous statement and at the beginning of the session, + it is reset to FALSE. If such functions + as mysql_insert, mysql_update, mysql_delete etc modify a + non-transactional table, they set this flag to TRUE. At the + end of the statement, the value of stmt.modified_non_trans_table + is merged with all.modified_non_trans_table and gets reset. + * all.modified_non_trans_table is reset at the end of transaction + + * Since we do not have a dedicated context for execution of a + sub-statement, to keep track of non-transactional changes in a + sub-statement, we re-use stmt.modified_non_trans_table. + At entrance into a sub-statement, a copy of the value of + stmt.modified_non_trans_table (containing the changes of the + outer statement) is saved on stack. Then + stmt.modified_non_trans_table is reset to FALSE and the + substatement is executed. Then the new value is merged with the + saved value. + */ + bool modified_non_trans_table; } THD_TRANS; enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED, diff --git a/sql/log.cc b/sql/log.cc index 6992f6c10ef..e9aa273676a 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -162,7 +162,7 @@ static int binlog_rollback(THD *thd, bool all) table. Such cases should be rare (updating a non-transactional table inside a transaction...) */ - if (unlikely(thd->no_trans_update.all)) + if (unlikely(thd->transaction.all.modified_non_trans_table)) { Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE); qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE) @@ -217,7 +217,7 @@ static int binlog_savepoint_rollback(THD *thd, void *sv) non-transactional table. Otherwise, truncate the binlog cache starting from the SAVEPOINT command. */ - if (unlikely(thd->no_trans_update.all)) + if (unlikely(thd->transaction.all.modified_non_trans_table)) { Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE, FALSE); DBUG_RETURN(mysql_bin_log.write(&qinfo)); diff --git a/sql/set_var.cc b/sql/set_var.cc index b30aa008366..e1246617d84 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -2901,14 +2901,14 @@ static bool set_option_autocommit(THD *thd, set_var *var) { /* We changed to auto_commit mode */ thd->options&= ~(ulong) OPTION_BEGIN; - thd->no_trans_update.all= FALSE; + thd->transaction.all.modified_non_trans_table= FALSE; thd->server_status|= SERVER_STATUS_AUTOCOMMIT; if (ha_commit(thd)) return 1; } else { - thd->no_trans_update.all= FALSE; + thd->transaction.all.modified_non_trans_table= FALSE; thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT; } } diff --git a/sql/sp_head.cc b/sql/sp_head.cc index fd8724b2171..589e59faca4 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -337,13 +337,13 @@ sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr) enum_check_fields save_count_cuted_fields= thd->count_cuted_fields; bool save_abort_on_warning= thd->abort_on_warning; - bool save_no_trans_update_stmt= thd->no_trans_update.stmt; + bool save_stmt_modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table; thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL; thd->abort_on_warning= thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES); - thd->no_trans_update.stmt= FALSE; + thd->transaction.stmt.modified_non_trans_table= FALSE; /* Save the value in the field. Convert the value if needed. */ @@ -351,7 +351,7 @@ sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr) thd->count_cuted_fields= save_count_cuted_fields; thd->abort_on_warning= save_abort_on_warning; - thd->no_trans_update.stmt= save_no_trans_update_stmt; + thd->transaction.stmt.modified_non_trans_table= save_stmt_modified_non_trans_table; if (thd->net.report_error) { @@ -2400,7 +2400,13 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp, bool open_tables, sp_instr* instr) { int res= 0; - + /* + The flag is saved at the entry to the following substatement. + It's reset further in the common code part. + It's merged with the saved parent's value at the exit of this func. + */ + bool parent_modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table; + thd->transaction.stmt.modified_non_trans_table= FALSE; DBUG_ASSERT(!thd->derived_tables); DBUG_ASSERT(thd->change_list.is_empty()); /* @@ -2467,7 +2473,11 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp, /* Update the state of the active arena. */ thd->stmt_arena->state= Query_arena::EXECUTED; - + /* + Merge here with the saved parent's values + what is needed from the substatement gained + */ + thd->transaction.stmt.modified_non_trans_table |= parent_modified_non_trans_table; /* Unlike for PS we should not call Item's destructors for newly created items after execution of each instruction in stored routine. This is diff --git a/sql/sql_class.cc b/sql/sql_class.cc index ee4e1ea149c..1866576aa3a 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -339,7 +339,7 @@ void THD::init(void) if (variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) server_status|= SERVER_STATUS_NO_BACKSLASH_ESCAPES; options= thd_startup_options; - no_trans_update.stmt= no_trans_update.all= FALSE; + transaction.all.modified_non_trans_table= transaction.stmt.modified_non_trans_table= FALSE; open_options=ha_open_options; update_lock_default= (variables.low_priority_updates ? TL_WRITE_LOW_PRIORITY : diff --git a/sql/sql_class.h b/sql/sql_class.h index 058f130d4e7..1c84fd32965 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1460,10 +1460,6 @@ public: bool charset_is_system_charset, charset_is_collation_connection; bool charset_is_character_set_filesystem; bool enable_slow_log; /* enable slow log for current statement */ - struct { - bool all:1; - bool stmt:1; - } no_trans_update; bool abort_on_warning; bool got_warning; /* Set on call to push_warning() */ bool no_warnings_for_error; /* no warnings on call to my_error() */ @@ -1714,7 +1710,7 @@ public: inline bool really_abort_on_warning() { return (abort_on_warning && - (!no_trans_update.stmt || + (!transaction.stmt.modified_non_trans_table || (variables.sql_mode & MODE_STRICT_ALL_TABLES))); } void set_status_var_init(); diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index bccd4d4cafe..56edfa6c5b2 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -315,6 +315,9 @@ cleanup: delete select; transactional_table= table->file->has_transactions(); + if (!transactional_table && deleted > 0) + thd->transaction.stmt.modified_non_trans_table= TRUE; + /* See similar binlogging code in sql_update.cc, for comments */ if ((error < 0) || (deleted && !transactional_table)) { @@ -327,9 +330,10 @@ cleanup: if (mysql_bin_log.write(&qinfo) && transactional_table) error=1; } - if (!transactional_table) - thd->no_trans_update.all= TRUE; + if (thd->transaction.stmt.modified_non_trans_table) + thd->transaction.all.modified_non_trans_table= TRUE; } + DBUG_ASSERT(transactional_table || !deleted || thd->transaction.stmt.modified_non_trans_table); free_underlaid_joins(thd, select_lex); if (transactional_table) { @@ -642,20 +646,22 @@ bool multi_delete::send_data(List &values) if (table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_DELETE, TRG_ACTION_BEFORE, FALSE)) - DBUG_RETURN(1); + DBUG_RETURN(1); table->status|= STATUS_DELETED; if (!(error=table->file->delete_row(table->record[0]))) { - deleted++; + deleted++; + if (!table->file->has_transactions()) + thd->transaction.stmt.modified_non_trans_table= TRUE; if (table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_DELETE, TRG_ACTION_AFTER, FALSE)) - DBUG_RETURN(1); + DBUG_RETURN(1); } else { - table->file->print_error(error,MYF(0)); - DBUG_RETURN(1); + table->file->print_error(error,MYF(0)); + DBUG_RETURN(1); } } else @@ -705,6 +711,7 @@ void multi_delete::send_error(uint errcode,const char *err) error= 1; send_eof(); } + DBUG_ASSERT(!normal_tables || !deleted || thd->transaction.stmt.modified_non_trans_table); DBUG_VOID_RETURN; } @@ -732,6 +739,7 @@ int multi_delete::do_deletes() for (; table_being_deleted; table_being_deleted= table_being_deleted->next_local, counter++) { + ha_rows last_deleted= deleted; TABLE *table = table_being_deleted->table; if (tempfiles[counter]->get(table)) { @@ -769,6 +777,8 @@ int multi_delete::do_deletes() break; } } + if (last_deleted != deleted && !table->file->has_transactions()) + thd->transaction.stmt.modified_non_trans_table= TRUE; end_read_record(&info); if (thd->killed && !local_error) local_error= 1; @@ -807,7 +817,6 @@ bool multi_delete::send_eof() { query_cache_invalidate3(thd, delete_tables, 1); } - if ((local_error == 0) || (deleted && normal_tables)) { if (mysql_bin_log.is_open()) @@ -819,9 +828,11 @@ bool multi_delete::send_eof() if (mysql_bin_log.write(&qinfo) && !normal_tables) local_error=1; // Log write failed: roll back the SQL statement } - if (!transactional_tables) - thd->no_trans_update.all= TRUE; + if (thd->transaction.stmt.modified_non_trans_table) + thd->transaction.all.modified_non_trans_table= TRUE; } + DBUG_ASSERT(!normal_tables || !deleted || thd->transaction.stmt.modified_non_trans_table); + /* Commit or rollback the current SQL statement */ if (transactional_tables) if (ha_autocommit_or_rollback(thd,local_error > 0)) diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 5ba1e766947..5edce08e481 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -733,7 +733,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, if (lock_type != TL_WRITE_DELAYED && !thd->prelocked_mode) table->file->start_bulk_insert(values_list.elements); - thd->no_trans_update.stmt= FALSE; thd->abort_on_warning= (!ignore && (thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))); @@ -907,10 +906,12 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, if (mysql_bin_log.write(&qinfo) && transactional_table) error=1; } - if (!transactional_table && changed) - thd->no_trans_update.all= TRUE; + if (thd->transaction.stmt.modified_non_trans_table) + thd->transaction.all.modified_non_trans_table= TRUE; } } + DBUG_ASSERT(transactional_table || !changed || + thd->transaction.stmt.modified_non_trans_table); if (transactional_table) error=ha_autocommit_or_rollback(thd,error); @@ -1311,7 +1312,7 @@ static int last_uniq_key(TABLE *table,uint keynr) then both on update triggers will work instead. Similarly both on delete triggers will be invoked if we will delete conflicting records. - Sets thd->no_trans_update.stmt to TRUE if table which is updated didn't have + Sets thd->transaction.stmt.modified_non_trans_table to TRUE if table which is updated didn't have transactions. RETURN VALUE @@ -1478,7 +1479,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) goto err; info->deleted++; if (!table->file->has_transactions()) - thd->no_trans_update.stmt= TRUE; + thd->transaction.stmt.modified_non_trans_table= TRUE; if (table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_DELETE, TRG_ACTION_AFTER, TRUE)) @@ -1510,7 +1511,7 @@ ok_or_after_trg_err: if (key) my_safe_afree(key,table->s->max_unique_length,MAX_KEY_LENGTH); if (!table->file->has_transactions()) - thd->no_trans_update.stmt= TRUE; + thd->transaction.stmt.modified_non_trans_table= TRUE; DBUG_RETURN(trg_error); err: @@ -2790,7 +2791,6 @@ select_insert::prepare(List &values, SELECT_LEX_UNIT *u) } if (info.handle_duplicates == DUP_UPDATE) table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE); - thd->no_trans_update.stmt= FALSE; thd->abort_on_warning= (!info.ignore && (thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | @@ -2927,7 +2927,8 @@ void select_insert::send_error(uint errcode,const char *err) bool select_insert::send_eof() { - int error,error2; + int error, error2; + bool changed, transactional_table= table->file->has_transactions(); DBUG_ENTER("select_insert::send_eof"); error= (!thd->prelocked_mode) ? table->file->end_bulk_insert():0; @@ -2939,12 +2940,14 @@ bool select_insert::send_eof() and ha_autocommit_or_rollback */ - if (info.copied || info.deleted || info.updated) + if (changed= (info.copied || info.deleted || info.updated)) { query_cache_invalidate3(thd, table, 1); - if (!(table->file->has_transactions() || table->s->tmp_table)) - thd->no_trans_update.all= TRUE; + if (thd->transaction.stmt.modified_non_trans_table) + thd->transaction.all.modified_non_trans_table= TRUE; } + DBUG_ASSERT(transactional_table || !changed || + thd->transaction.stmt.modified_non_trans_table); if (last_insert_id) thd->insert_id(info.copied ? last_insert_id : 0); // For binary log @@ -2954,7 +2957,7 @@ bool select_insert::send_eof() if (!error) thd->clear_error(); Query_log_event qinfo(thd, thd->query, thd->query_length, - table->file->has_transactions(), FALSE); + transactional_table, FALSE); mysql_bin_log.write(&qinfo); } if ((error2=ha_autocommit_or_rollback(thd,error)) && ! error) @@ -2980,6 +2983,7 @@ bool select_insert::send_eof() void select_insert::abort() { + bool changed, transactional_table; DBUG_ENTER("select_insert::abort"); if (!table) @@ -2990,6 +2994,7 @@ void select_insert::abort() */ DBUG_VOID_RETURN; } + transactional_table= table->file->has_transactions(); if (!thd->prelocked_mode) table->file->end_bulk_insert(); /* @@ -2998,21 +3003,22 @@ void select_insert::abort() error while inserting into a MyISAM table) we must write to the binlog (and the error code will make the slave stop). */ - if ((info.copied || info.deleted || info.updated) && - !table->file->has_transactions()) + if ((changed= info.copied || info.deleted || info.updated) && + !transactional_table) { if (last_insert_id) thd->insert_id(last_insert_id); // For binary log if (mysql_bin_log.is_open()) { Query_log_event qinfo(thd, thd->query, thd->query_length, - table->file->has_transactions(), FALSE); + transactional_table, FALSE); mysql_bin_log.write(&qinfo); } - if (!table->s->tmp_table) - thd->no_trans_update.all= TRUE; + if (thd->transaction.stmt.modified_non_trans_table) + thd->transaction.all.modified_non_trans_table= TRUE; } - if (info.copied || info.deleted || info.updated) + DBUG_ASSERT(transactional_table || !changed || thd->transaction.stmt.modified_non_trans_table); + if (changed) { query_cache_invalidate3(thd, table, 1); } @@ -3259,7 +3265,6 @@ select_create::prepare(List &values, SELECT_LEX_UNIT *u) table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE); if (!thd->prelocked_mode) table->file->start_bulk_insert((ha_rows) 0); - thd->no_trans_update.stmt= FALSE; thd->abort_on_warning= (!info.ignore && (thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 7b1799baaad..55cbbf1c540 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -377,7 +377,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, table->file->start_bulk_insert((ha_rows) 0); table->copy_blobs=1; - thd->no_trans_update.stmt= FALSE; thd->abort_on_warning= (!ignore && (thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | @@ -411,7 +410,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, ha_autocommit_... */ query_cache_invalidate3(thd, table_list, 0); - if (error) { if (read_file_from_client) @@ -466,8 +464,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, sprintf(name, ER(ER_LOAD_INFO), (ulong) info.records, (ulong) info.deleted, (ulong) (info.records - info.copied), (ulong) thd->cuted_fields); - if (!transactional_table) - thd->no_trans_update.all= TRUE; + if (thd->transaction.stmt.modified_non_trans_table) + thd->transaction.all.modified_non_trans_table= TRUE; #ifndef EMBEDDED_LIBRARY if (mysql_bin_log.is_open()) { @@ -488,6 +486,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, /* ok to client sent only after binlog write and engine commit */ send_ok(thd, info.copied + info.deleted, 0L, name); err: + DBUG_ASSERT(transactional_table || !(info.copied || info.deleted) || + thd->transaction.stmt.modified_non_trans_table); if (thd->lock) { mysql_unlock_tables(thd, thd->lock); @@ -532,7 +532,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, Item_field *sql_field; TABLE *table= table_list->table; ulonglong id; - bool no_trans_update_stmt, err; + bool err; DBUG_ENTER("read_fixed_length"); id= 0; @@ -560,7 +560,6 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, #ifdef HAVE_purify read_info.row_end[0]=0; #endif - no_trans_update_stmt= !table->file->has_transactions(); restore_record(table, s->default_values); /* @@ -630,7 +629,6 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, table->auto_increment_field_not_null= FALSE; if (err) DBUG_RETURN(1); - thd->no_trans_update.stmt= no_trans_update_stmt; /* If auto_increment values are used, save the first one for @@ -673,12 +671,11 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, TABLE *table= table_list->table; uint enclosed_length; ulonglong id; - bool no_trans_update_stmt, err; + bool err; DBUG_ENTER("read_sep_field"); enclosed_length=enclosed.length(); id= 0; - no_trans_update_stmt= !table->file->has_transactions(); for (;;it.rewind()) { @@ -821,7 +818,6 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, We don't need to reset auto-increment field since we are restoring its default value at the beginning of each loop iteration. */ - thd->no_trans_update.stmt= no_trans_update_stmt; if (read_info.next_line()) // Skip to next line break; if (read_info.line_cuted) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ae3bc0f5597..7d723d3cd5b 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -149,7 +149,7 @@ static bool end_active_trans(THD *thd) if (ha_commit(thd)) error=1; thd->options&= ~(ulong) OPTION_BEGIN; - thd->no_trans_update.all= FALSE; + thd->transaction.all.modified_non_trans_table= FALSE; } DBUG_RETURN(error); } @@ -173,7 +173,7 @@ static bool begin_trans(THD *thd) else { LEX *lex= thd->lex; - thd->no_trans_update.all= FALSE; + thd->transaction.all.modified_non_trans_table= FALSE; thd->options|= (ulong) OPTION_BEGIN; thd->server_status|= SERVER_STATUS_IN_TRANS; if (lex->start_transaction_opt & MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT) @@ -1471,7 +1471,7 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion) thd->server_status&= ~SERVER_STATUS_IN_TRANS; res= ha_commit(thd); thd->options&= ~(ulong) OPTION_BEGIN; - thd->no_trans_update.all= FALSE; + thd->transaction.all.modified_non_trans_table= FALSE; break; case COMMIT_RELEASE: do_release= 1; /* fall through */ @@ -1489,7 +1489,7 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion) if (ha_rollback(thd)) res= -1; thd->options&= ~(ulong) OPTION_BEGIN; - thd->no_trans_update.all= FALSE; + thd->transaction.all.modified_non_trans_table= FALSE; if (!res && (completion == ROLLBACK_AND_CHAIN)) res= begin_trans(thd); break; @@ -2600,6 +2600,8 @@ mysql_execute_command(THD *thd) statistic_increment(thd->status_var.com_stat[lex->sql_command], &LOCK_status); + DBUG_ASSERT(thd->transaction.stmt.modified_non_trans_table == FALSE); + switch (lex->sql_command) { case SQLCOM_SELECT: { @@ -2937,7 +2939,7 @@ mysql_execute_command(THD *thd) else { /* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */ - thd->no_trans_update.all= TRUE; + thd->transaction.all.modified_non_trans_table= TRUE; } DBUG_ASSERT(first_table == all_tables && first_table != 0); bool link_to_local; @@ -3720,7 +3722,7 @@ end_with_restore_list: lex->drop_if_exists= 1; /* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */ - thd->no_trans_update.all= TRUE; + thd->transaction.all.modified_non_trans_table= TRUE; } /* DDL and binlog write order protected by LOCK_open */ res= mysql_rm_table(thd, first_table, lex->drop_if_exists, @@ -4322,7 +4324,7 @@ end_with_restore_list: res= TRUE; // cannot happen else { - if (thd->no_trans_update.all && + if (thd->transaction.all.modified_non_trans_table && !thd->slave_thread) push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARNING_NOT_COMPLETE_ROLLBACK, @@ -4969,7 +4971,7 @@ create_sp_error: thd->transaction.xid_state.xa_state=XA_ACTIVE; thd->transaction.xid_state.xid.set(thd->lex->xid); xid_cache_insert(&thd->transaction.xid_state); - thd->no_trans_update.all= FALSE; + thd->transaction.all.modified_non_trans_table= FALSE; thd->options|= (ulong) OPTION_BEGIN; thd->server_status|= SERVER_STATUS_IN_TRANS; send_ok(thd); @@ -5064,7 +5066,7 @@ create_sp_error: break; } thd->options&= ~(ulong) OPTION_BEGIN; - thd->no_trans_update.all= FALSE; + thd->transaction.all.modified_non_trans_table= FALSE; thd->server_status&= ~SERVER_STATUS_IN_TRANS; xid_cache_delete(&thd->transaction.xid_state); thd->transaction.xid_state.xa_state=XA_NOTR; @@ -5095,7 +5097,7 @@ create_sp_error: else send_ok(thd); thd->options&= ~(ulong) OPTION_BEGIN; - thd->no_trans_update.all= FALSE; + thd->transaction.all.modified_non_trans_table= FALSE; thd->server_status&= ~SERVER_STATUS_IN_TRANS; xid_cache_delete(&thd->transaction.xid_state); thd->transaction.xid_state.xa_state=XA_NOTR; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 7db79543016..d83100aa439 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4091,7 +4091,6 @@ copy_data_between_tables(TABLE *from,TABLE *to, alter_table_manage_keys(to, from->file->indexes_are_disabled(), keys_onoff); /* We can abort alter table for any table type */ - thd->no_trans_update.stmt= FALSE; thd->abort_on_warning= !ignore && test(thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index f4239afc4cd..e20647dc808 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -430,7 +430,6 @@ int mysql_update(THD *thd, query_id=thd->query_id; transactional_table= table->file->has_transactions(); - thd->no_trans_update.stmt= FALSE; thd->abort_on_warning= test(!ignore && (thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | @@ -487,7 +486,6 @@ int mysql_update(THD *thd, (byte*) table->record[0]))) { updated++; - thd->no_trans_update.stmt= !transactional_table; if (table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, @@ -522,6 +520,10 @@ int mysql_update(THD *thd, thd->row_count++; } + if (!transactional_table && updated > 0) + thd->transaction.stmt.modified_non_trans_table= TRUE; + + /* todo bug#27571: to avoid asynchronization of `error' and `error_code' of binlog event constructor @@ -589,9 +591,10 @@ int mysql_update(THD *thd, if (mysql_bin_log.write(&qinfo) && transactional_table) error=1; // Rollback update } - if (!transactional_table) - thd->no_trans_update.all= TRUE; + if (thd->transaction.stmt.modified_non_trans_table) + thd->transaction.all.modified_non_trans_table= TRUE; } + DBUG_ASSERT(transactional_table || !updated || thd->transaction.stmt.modified_non_trans_table); free_underlaid_joins(thd, select_lex); if (transactional_table) { @@ -955,7 +958,6 @@ bool mysql_multi_update(THD *thd, handle_duplicates, ignore))) DBUG_RETURN(TRUE); - thd->no_trans_update.stmt= FALSE; thd->abort_on_warning= test(thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)); @@ -1331,9 +1333,7 @@ multi_update::~multi_update() if (copy_field) delete [] copy_field; thd->count_cuted_fields= CHECK_FIELD_IGNORE; // Restore this setting - if (!trans_safe) // todo: remove since redundant - thd->no_trans_update.all= TRUE; - DBUG_ASSERT(trans_safe || thd->no_trans_update.all); + DBUG_ASSERT(trans_safe || thd->transaction.all.modified_non_trans_table); } @@ -1426,7 +1426,7 @@ bool multi_update::send_data(List ¬_used_values) else { trans_safe= 0; - thd->no_trans_update.stmt= TRUE; + thd->transaction.stmt.modified_non_trans_table= TRUE; } if (table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, @@ -1489,7 +1489,6 @@ void multi_update::send_error(uint errcode,const char *err) /* Something already updated so we have to invalidate cache */ query_cache_invalidate3(thd, update_tables, 1); - /* If all tables that has been updated are trans safe then just do rollback. If not attempt to do remaining updates. @@ -1502,7 +1501,7 @@ void multi_update::send_error(uint errcode,const char *err) } else { - DBUG_ASSERT(thd->no_trans_update.stmt); + DBUG_ASSERT(thd->transaction.stmt.modified_non_trans_table); if (do_update && table_count > 1) { /* Add warning here */ @@ -1513,7 +1512,7 @@ void multi_update::send_error(uint errcode,const char *err) VOID(do_updates(0)); } } - if (thd->no_trans_update.stmt) + if (thd->transaction.stmt.modified_non_trans_table) { /* The query has to binlog because there's a modified non-transactional table @@ -1526,9 +1525,9 @@ void multi_update::send_error(uint errcode,const char *err) mysql_bin_log.write(&qinfo); } if (!trans_safe) - thd->no_trans_update.all= TRUE; + thd->transaction.all.modified_non_trans_table= TRUE; } - DBUG_ASSERT(trans_safe || !updated || thd->no_trans_update.stmt); + DBUG_ASSERT(trans_safe || !updated || thd->transaction.stmt.modified_non_trans_table); if (transactional_tables) { @@ -1664,7 +1663,7 @@ int multi_update::do_updates(bool from_send_error) else { trans_safe= 0; // Can't do safe rollback - thd->no_trans_update.stmt= TRUE; + thd->transaction.stmt.modified_non_trans_table= TRUE; } } (void) table->file->ha_rnd_end(); @@ -1697,7 +1696,7 @@ err2: else { trans_safe= 0; - thd->no_trans_update.stmt= TRUE; + thd->transaction.stmt.modified_non_trans_table= TRUE; } } DBUG_RETURN(1); @@ -1722,7 +1721,6 @@ bool multi_update::send_eof() { query_cache_invalidate3(thd, update_tables, 1); } - /* Write the SQL statement to the binlog if we updated rows and we succeeded or if we updated some non @@ -1732,8 +1730,9 @@ bool multi_update::send_eof() either from the query's list or via a stored routine: bug#13270,23333 */ - DBUG_ASSERT(trans_safe || !updated || thd->no_trans_update.stmt); - if (local_error == 0 || thd->no_trans_update.stmt) + DBUG_ASSERT(trans_safe || !updated || + thd->transaction.stmt.modified_non_trans_table); + if (local_error == 0 || thd->transaction.stmt.modified_non_trans_table) { if (mysql_bin_log.is_open()) { @@ -1746,8 +1745,8 @@ bool multi_update::send_eof() if (mysql_bin_log.write(&qinfo) && trans_safe) local_error= 1; // Rollback update } - if (!trans_safe) - thd->no_trans_update.all= TRUE; + if (thd->transaction.stmt.modified_non_trans_table) + thd->transaction.all.modified_non_trans_table= TRUE; } if (transactional_tables) From 77edfb16e8a699d87694a7b3aff95118c5104d83 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 Jul 2007 21:05:56 +0500 Subject: [PATCH 35/49] bigint.test: Fixing a typo in the test case. mysql-test/t/bigint.test: Fixing a typo in the test case. --- mysql-test/t/bigint.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 4aef7395184..002dfad9981 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -307,6 +307,6 @@ select -(9223372036854775808); select -((9223372036854775808)); select -(-(9223372036854775808)); --disable_metadata ---endble_ps_protocol +--enable_ps_protocol select --9223372036854775808, ---9223372036854775808, ----9223372036854775808; select -(-9223372036854775808), -(-(-9223372036854775808)); From 8d0526a82df90407578dfac4d57321d03f65a6f6 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 Jul 2007 20:40:49 +0200 Subject: [PATCH 36/49] my_pthread.c: Backport of correction for Mac OS X build problem, global variable not initiated is "common" and can't be used in shared libraries, unless special flags are used (bug#26218) mysys/my_pthread.c: Backport of correction for Mac OS X build problem, global variable not initiated is "common" and can't be used in shared libraries, unless special flags are used (bug#26218) --- mysys/my_pthread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index 14ba6aabf0e..50c0a82d2d8 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -30,7 +30,7 @@ #define SCHED_POLICY SCHED_OTHER #endif -uint thd_lib_detected; +uint thd_lib_detected= 0; #ifndef my_pthread_setprio void my_pthread_setprio(pthread_t thread_id,int prior) From 16ff419b8ae86ccbf017d19ee00141e3e1c05988 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 Jul 2007 21:09:45 +0200 Subject: [PATCH 37/49] Generate "config.h" directly into the "include" directory, later copied to "my_config.h". Not to pollute the top directory, and to get more control over what is included. Made the include path for "libedit" pick up its own "config.h" first. config/ac-macros/misc.m4: aclocal in automake 1.8 can't handle AC_REQUIRE on a user macro defined in the same included file. cmd-line-utils/libedit/Makefile.am: Changed include path so that current directory is taken first, as there is a "config.h" there with the same name as the one in top "include". configure.in: Generate "config.h" directly into "include", don't pollute top directory include/Makefile.am: Copy "config.h" from current directory to "my_config.h", added note in the make file why there are two identical files with different name. scripts/make_binary_distribution.sh: Removed copy of "config.h" from top directory, it is in "include" in a source tree. --- cmd-line-utils/libedit/Makefile.am | 4 ++-- config/ac-macros/misc.m4 | 1 - configure.in | 2 +- include/Makefile.am | 7 +++++-- scripts/make_binary_distribution.sh | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am index ae6755f1c5c..b7611193aea 100644 --- a/cmd-line-utils/libedit/Makefile.am +++ b/cmd-line-utils/libedit/Makefile.am @@ -5,8 +5,8 @@ ASRC = $(srcdir)/vi.c $(srcdir)/emacs.c $(srcdir)/common.c AHDR = vi.h emacs.h common.h -INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ - -I$(srcdir)/../.. -I.. +# Make sure to include stuff from this directory first, to get right "config.h" +INCLUDES = -I. -I$(top_builddir)/include -I$(top_srcdir)/include noinst_LIBRARIES = libedit.a diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4 index 09081fb3eac..60c0469e449 100644 --- a/config/ac-macros/misc.m4 +++ b/config/ac-macros/misc.m4 @@ -763,7 +763,6 @@ AC_SUBST(CXX_VERSION) ]) AC_DEFUN([MYSQL_PROG_AR], [ -AC_REQUIRE([MYSQL_CHECK_CXX_VERSION]) case $CXX_VERSION in MIPSpro*) AR=$CXX diff --git a/configure.in b/configure.in index 843837b9348..3db6d0bfb8d 100644 --- a/configure.in +++ b/configure.in @@ -8,7 +8,7 @@ AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb AM_INIT_AUTOMAKE(mysql, 5.0.48) -AM_CONFIG_HEADER(config.h) +AM_CONFIG_HEADER([include/config.h:config.h.in]) PROTOCOL_VERSION=10 DOT_FRM_VERSION=6 diff --git a/include/Makefile.am b/include/Makefile.am index 2cd72052a15..c856b6398fe 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -49,8 +49,11 @@ link_sources: @readline_h_ln_cmd@ @yassl_h_ln_cmd@ -my_config.h: ../config.h - $(CP) ../config.h my_config.h +# We want both "my_config.h" and "config.h" that are identical, as +# MySQL sources assumes the name "my_config.h", and 3rd party sources +# assumes the name "config.h". +my_config.h: config.h + $(CP) config.h my_config.h # These files should not be included in distributions since they are # generated by configure from the .h.in files diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index dab1bbec956..a87bb03526d 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -257,7 +257,7 @@ if [ $BASE_SYSTEM = "netware" ] ; then rm -f $BASE/lib/*.la fi -copyfileto $BASE/include config.h include/* +copyfileto $BASE/include include/* rm -f $BASE/include/Makefile* $BASE/include/*.in $BASE/include/config-win.h if [ $BASE_SYSTEM != "netware" ] ; then From 791584ae0d57ce1f31b4652c1dd9cb4edee8526e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Jul 2007 10:46:04 +0500 Subject: [PATCH 38/49] Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself returns empty. As a result of this bug 'SELECT AGGREGATE_FUNCTION(fld) ... GROUP BY' can return one row instead of an empty result set. When GROUP BY only has fields of constant tables (with a single row), the optimizer deletes the group_list. After that we lose the information about whether we had an GROUP BY statement. Though it's important as SELECT min(x) from empty_table; and SELECT min(x) from empty_table GROUP BY y; have to return different results - the first query should return one row, second - an empty result set. So here we add the 'group_optimized_away' flag to remember this case when GROUP BY exists in the query and is removed by the optimizer, and check this flag in end_send_group() mysql-test/r/group_by.result: Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself returns empty. test result mysql-test/r/insert_select.result: Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself returns empty. test result mysql-test/t/group_by.test: Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself returns empty. This is additional testcase that is more basic than the original bug's testcase and has the same reason. mysql-test/t/insert_select.test: Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself returns empty. test case sql/sql_select.cc: Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself returns empty. Remember the 'GROUP BY was optimized away' case in the JOIN::group_optimized and check this in the end_send_group() sql/sql_select.h: Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself returns empty. JOIN::group_optimized member added to remember the 'GROUP BY optimied away' case --- mysql-test/r/group_by.result | 17 +++++++++++++++++ mysql-test/r/insert_select.result | 26 ++++++++++++++++++++++++++ mysql-test/t/group_by.test | 23 +++++++++++++++++++++++ mysql-test/t/insert_select.test | 28 ++++++++++++++++++++++++++++ sql/sql_select.cc | 4 +++- sql/sql_select.h | 9 +++++++++ 6 files changed, 106 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 61b73dc7005..f717c16742f 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -818,3 +818,20 @@ a 2 1 DROP TABLE t1; +CREATE TABLE t1 ( +f1 int(10) unsigned NOT NULL auto_increment primary key, +f2 varchar(100) NOT NULL default '' +); +CREATE TABLE t2 ( +f1 varchar(10) NOT NULL default '', +f2 char(3) NOT NULL default '', +PRIMARY KEY (`f1`), +KEY `k1` (`f2`,`f1`) +); +INSERT INTO t1 values(NULL, ''); +INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT'); +SELECT SQL_BUFFER_RESULT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1; +avg(t2.f1) +SELECT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1; +avg(t2.f1) +DROP TABLE t1, t2; diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index 1d7aef256e1..601eb2aa0bc 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -690,3 +690,29 @@ CREATE TABLE t1 (a int PRIMARY KEY); INSERT INTO t1 values (1), (2); INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1; DROP TABLE t1; +CREATE TABLE t1 ( +f1 int(10) unsigned NOT NULL auto_increment PRIMARY KEY, +f2 varchar(100) NOT NULL default '' +); +CREATE TABLE t2 ( +f1 varchar(10) NOT NULL default '', +f2 char(3) NOT NULL default '', +PRIMARY KEY (`f1`), +KEY `k1` (`f2`, `f1`) +); +INSERT INTO t1 values(NULL, ''); +INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT'); +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1; +min(t2.f1) +INSERT INTO t1 (f2) +SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1; +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +SELECT * FROM t1; +f1 f2 +1 +DROP TABLE t1, t2; diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 064d46aa0c0..180299f7f4a 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -633,4 +633,27 @@ SELECT a FROM t1 ORDER BY 'a' DESC; SELECT a FROM t1 ORDER BY "a" DESC; SELECT a FROM t1 ORDER BY `a` DESC; DROP TABLE t1; + + +# +# Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself +# returns empty +# +CREATE TABLE t1 ( + f1 int(10) unsigned NOT NULL auto_increment primary key, + f2 varchar(100) NOT NULL default '' +); +CREATE TABLE t2 ( + f1 varchar(10) NOT NULL default '', + f2 char(3) NOT NULL default '', + PRIMARY KEY (`f1`), + KEY `k1` (`f2`,`f1`) +); + +INSERT INTO t1 values(NULL, ''); +INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT'); +SELECT SQL_BUFFER_RESULT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1; +SELECT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1; +DROP TABLE t1, t2; + # End of 4.1 tests diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index fcea489fcff..dfb313706dd 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -239,4 +239,32 @@ INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1; DROP TABLE t1; +# +# Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself returns empty +# + +CREATE TABLE t1 ( + f1 int(10) unsigned NOT NULL auto_increment PRIMARY KEY, + f2 varchar(100) NOT NULL default '' +); +CREATE TABLE t2 ( + f1 varchar(10) NOT NULL default '', + f2 char(3) NOT NULL default '', + PRIMARY KEY (`f1`), + KEY `k1` (`f2`, `f1`) +); + +INSERT INTO t1 values(NULL, ''); +INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT'); +SELECT COUNT(*) FROM t1; + +SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1; + +INSERT INTO t1 (f2) + SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1; + +SELECT COUNT(*) FROM t1; +SELECT * FROM t1; +DROP TABLE t1, t2; + # End of 4.1 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 8b5664a7f96..8f0ad359f43 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -777,6 +777,7 @@ JOIN::optimize() order=0; // The output has only one row simple_order=1; select_distinct= 0; // No need in distinct for 1 row + group_optimized_away= 1; } calc_group_buffer(this, group_list); @@ -6896,7 +6897,8 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), if (!join->first_record || end_of_records || (idx=test_if_group_changed(join->group_fields)) >= 0) { - if (join->first_record || (end_of_records && !join->group)) + if (join->first_record || + (end_of_records && !join->group && !join->group_optimized_away)) { if (join->procedure) join->procedure->end_group(); diff --git a/sql/sql_select.h b/sql/sql_select.h index c61ef4fb92b..6227d6d2cc5 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -180,6 +180,14 @@ class JOIN :public Sql_alloc ROLLUP rollup; // Used with rollup bool select_distinct; // Set if SELECT DISTINCT + /* + If we have the GROUP BY statement in the query, + but the group_list was emptied by optimizer, this + flag is TRUE. + It happens when fields in the GROUP BY are from + constant table + */ + bool group_optimized_away; /* simple_xxxxx is set if ORDER/GROUP BY doesn't include any references @@ -276,6 +284,7 @@ class JOIN :public Sql_alloc ref_pointer_array_size= 0; zero_result_cause= 0; optimized= 0; + group_optimized_away= 0; fields_list= fields_arg; bzero((char*) &keyuse,sizeof(keyuse)); From 210243480cf0506809d28dd7502f73628483cd8b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Jul 2007 11:10:03 +0500 Subject: [PATCH 39/49] merging --- mysql-test/r/group_by.result | 17 +++++++++++++++++ mysql-test/r/insert_select.result | 26 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 88f635595d6..d4ffbe43a91 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -824,6 +824,23 @@ a 2 1 DROP TABLE t1; +CREATE TABLE t1 ( +f1 int(10) unsigned NOT NULL auto_increment primary key, +f2 varchar(100) NOT NULL default '' +); +CREATE TABLE t2 ( +f1 varchar(10) NOT NULL default '', +f2 char(3) NOT NULL default '', +PRIMARY KEY (`f1`), +KEY `k1` (`f2`,`f1`) +); +INSERT INTO t1 values(NULL, ''); +INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT'); +SELECT SQL_BUFFER_RESULT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1; +avg(t2.f1) +SELECT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1; +avg(t2.f1) +DROP TABLE t1, t2; create table t1 (c1 char(3), c2 char(3)); create table t2 (c3 char(3), c4 char(3)); insert into t1 values ('aaa', 'bb1'), ('aaa', 'bb2'); diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index 8cb94072818..d16562d97e2 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -699,6 +699,32 @@ Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_next 1 DROP TABLE t1; +CREATE TABLE t1 ( +f1 int(10) unsigned NOT NULL auto_increment PRIMARY KEY, +f2 varchar(100) NOT NULL default '' +); +CREATE TABLE t2 ( +f1 varchar(10) NOT NULL default '', +f2 char(3) NOT NULL default '', +PRIMARY KEY (`f1`), +KEY `k1` (`f2`, `f1`) +); +INSERT INTO t1 values(NULL, ''); +INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT'); +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1; +min(t2.f1) +INSERT INTO t1 (f2) +SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1; +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +SELECT * FROM t1; +f1 f2 +1 +DROP TABLE t1, t2; CREATE TABLE t1 (x int, y int); CREATE TABLE t2 (z int, y int); CREATE TABLE t3 (a int, b int); From 8a68e7d2dc67f9725325bb55ab451806b1f7ce7c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Jul 2007 15:19:06 +0400 Subject: [PATCH 40/49] BUG#29582: huge memory consumption with union, subselect, joins: - Don't call mysql_select() several times for the select that enumerates a temporary table with the results of the UNION. Making this call for every subquery execution caused O(#enumerated-rows-in-the-outer-query) memory allocations. - Instead, call join->reinit() and join->exec(), and = disable constant table detection for such joins, = provide special handling for table-less constant subqueries. sql/sql_select.cc: BUG#29582: huge memory consumption with union, subselect, joins: - Don't mark tables as constant if JOIN::no_const_tables flag is set sql/sql_select.h: BUG#29582: huge memory consumption with union, subselect, joins: - Don't mark tables as constant if JOIN::no_const_tables flag is set sql/sql_union.cc: BUG#29582: huge memory consumption with union, subselect, joins: - Don't call mysql_select() several times for the select that enumerates a temporary table with UNION results. - Instead, call join->reinit() and join->exec(). - Provide special handling for table-less constant subqueries. --- sql/sql_select.cc | 2 +- sql/sql_select.h | 10 +++++++++ sql/sql_union.cc | 57 +++++++++++++++++++++++++++++++++-------------- 3 files changed, 51 insertions(+), 18 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c62a19b2752..ebc48c2967c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2416,7 +2416,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds, if ((table->s->system || table->file->records <= 1) && ! s->dependent && !(table->file->table_flags() & HA_NOT_EXACT_COUNT) && - !table->fulltext_searched) + !table->fulltext_searched && !join->no_const_tables) { set_position(join,const_count++,s,(KEYUSE*) 0); } diff --git a/sql/sql_select.h b/sql/sql_select.h index 4f9f6e9ed48..5be4f111bef 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -277,6 +277,14 @@ public: SELECT_LEX_UNIT *unit; // select that processed SELECT_LEX *select_lex; + /* + TRUE <=> optimizer must not mark any table as a constant table. + This is needed for subqueries in form "a IN (SELECT .. UNION SELECT ..): + when we optimize the select that reads the results of the union from a + temporary table, we must not mark the temp. table as constant because + the number of rows in it may vary from one subquery execution to another. + */ + bool no_const_tables; JOIN *tmp_join; // copy of this JOIN to be used with temporary tables ROLLUP rollup; // Used with rollup @@ -397,6 +405,8 @@ public: tmp_table_param.init(); tmp_table_param.end_write_records= HA_POS_ERROR; rollup.state= ROLLUP::STATE_NONE; + + no_const_tables= FALSE; } int prepare(Item ***rref_pointer_array, TABLE_LIST *tables, uint wind_num, diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 373b03d45e6..16c4eeab4bb 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -545,6 +545,10 @@ bool st_select_lex_unit::exec() /* allocate JOIN for fake select only once (prevent mysql_select automatic allocation) + TODO: The above is nonsense. mysql_select() will not allocate the + join if one already exists. There must be some other reason why we + don't let it allocate the join. Perhaps this is because we need + some special parameter values passed to join constructor? */ if (!(fake_select_lex->join= new JOIN(thd, item_list, fake_select_lex->options, result))) @@ -552,33 +556,52 @@ bool st_select_lex_unit::exec() fake_select_lex->table_list.empty(); DBUG_RETURN(TRUE); } + fake_select_lex->join->no_const_tables= TRUE; /* Fake st_select_lex should have item list for correctref_array allocation. */ fake_select_lex->item_list= item_list; + saved_error= mysql_select(thd, &fake_select_lex->ref_pointer_array, + &result_table_list, + 0, item_list, NULL, + global_parameters->order_list.elements, + (ORDER*)global_parameters->order_list.first, + (ORDER*) NULL, NULL, (ORDER*) NULL, + fake_select_lex->options | SELECT_NO_UNLOCK, + result, this, fake_select_lex); } else { - JOIN_TAB *tab,*end; - for (tab=join->join_tab, end=tab+join->tables ; - tab && tab != end ; - tab++) - { - delete tab->select; - delete tab->quick; - } - join->init(thd, item_list, fake_select_lex->options, result); + if (describe) + { + /* + In EXPLAIN command, constant subqueries that do not use any + tables are executed two times: + - 1st time is a real evaluation to get the subquery value + - 2nd time is to produce EXPLAIN output rows. + 1st execution sets certain members (e.g. select_result) to perform + subquery execution rather than EXPLAIN line production. In order + to reset them back, we re-do all of the actions (yes it is ugly): + */ + join->init(thd, item_list, fake_select_lex->options, result); + saved_error= mysql_select(thd, &fake_select_lex->ref_pointer_array, + &result_table_list, + 0, item_list, NULL, + global_parameters->order_list.elements, + (ORDER*)global_parameters->order_list.first, + (ORDER*) NULL, NULL, (ORDER*) NULL, + fake_select_lex->options | SELECT_NO_UNLOCK, + result, this, fake_select_lex); + } + else + { + join->examined_rows= 0; + join->reinit(); + saved_error= join->exec(); + } } - saved_error= mysql_select(thd, &fake_select_lex->ref_pointer_array, - &result_table_list, - 0, item_list, NULL, - global_parameters->order_list.elements, - (ORDER*)global_parameters->order_list.first, - (ORDER*) NULL, NULL, (ORDER*) NULL, - fake_select_lex->options | SELECT_NO_UNLOCK, - result, this, fake_select_lex); fake_select_lex->table_list.empty(); if (!saved_error) From 21d639e573d483a354c8ddbf17471ee468cce926 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Jul 2007 14:42:56 +0300 Subject: [PATCH 41/49] addendum for the fix for bug 27417: extend the assert so it will run the testsuite --- sql/sql_update.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index e20647dc808..c78e246f518 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1333,7 +1333,8 @@ multi_update::~multi_update() if (copy_field) delete [] copy_field; thd->count_cuted_fields= CHECK_FIELD_IGNORE; // Restore this setting - DBUG_ASSERT(trans_safe || thd->transaction.all.modified_non_trans_table); + DBUG_ASSERT(trans_safe || !updated || + thd->transaction.all.modified_non_trans_table); } From 6c589f90846cbaaeea9f0ff86f4b6011aa8622a9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Jul 2007 16:15:56 +0400 Subject: [PATCH 42/49] Post-merge fixes --- sql/sql_union.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 16c4eeab4bb..25a0540e4dd 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -598,8 +598,8 @@ bool st_select_lex_unit::exec() else { join->examined_rows= 0; - join->reinit(); - saved_error= join->exec(); + saved_error= join->reinit(); + join->exec(); } } From a0af9b7e63e14c76aac2a16a75928855f93b288f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Jul 2007 17:42:48 +0400 Subject: [PATCH 43/49] ha_innodb.cc: Warning fixed. sql/ha_innodb.cc: Warning fixed. --- sql/ha_innodb.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 585c825c710..f87d47174ac 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -465,7 +465,8 @@ convert_error_code_to_mysql( latest SQL statement in a lock wait timeout. Previously, we rolled back the whole transaction. */ - mark_transaction_to_rollback(thd, row_rollback_on_timeout); + mark_transaction_to_rollback(thd, + (bool)row_rollback_on_timeout); return(HA_ERR_LOCK_WAIT_TIMEOUT); From f5b95d0be141416c95a657d42ef39937d01c4c8e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Aug 2007 04:56:58 +0200 Subject: [PATCH 44/49] Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 mysqld hasn't been built on AIX with ndb-everything in quite a while. this allowed a variety of changes to be added that broke the AIX build for both the GNU and IBM compilers (but the IBM suite in particular). Changeset lets build to complete on AIX 5.2 for users of the GNU and the IBM suite both. Tudo bem? config/ac-macros/large_file.m4: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (2) we no longer declare anything large-file on AIX. the GNU C++ compiler declares _LARGE_FILE_API all of its own, and either way we're now pulling in when on AIX, which defines _LARGE_FILE_API (if not already defined). configure.in: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (1) build NDB binaries as static on AIX. because that actually *works*. when building dynamic, with the IBM compiler (xlC_r), and the build breaks on AIX due to missing symbols (__vec__delete2 et al.), try adding -lhC to the Makefile. include/mysql.h: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (2) we're now pulling in when on AIX, which defines _LARGE_FILE_API (if not already defined). ndb/src/common/util/File.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (3) do not de-scope the standards, for they may be funky macros ndb/src/mgmclient/Makefile.am: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (4) make IBM C++ compiler happy on AIX ndb/src/mgmsrv/Makefile.am: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (5) GNU compiler has no sense of humour about this ndb/test/ndbapi/benchronja.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) ndb/test/ndbapi/flexAsynch.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) ndb/test/ndbapi/flexHammer.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) ndb/test/ndbapi/flexScan.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) ndb/test/ndbapi/flexTT.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) ndb/test/ndbapi/flexTimedAsynch.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) ndb/test/ndbapi/initronja.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) ndb/test/ndbapi/testOperations.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (7) IBM C compiler on AIX is not happy with the re-def. ndb/test/ndbapi/testScanFilter.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (8) The IBM C++ compiler on AIX doesn't like initializing from pow(). This works, but breaks a VAL (bool res_cal[TUPLE_NUM] ...) later on. ndb/test/odbc/SQL99_test/SQL99_test.cpp: Bug #10776: Failure to compile ndb ReadNodesConf.cpp on AIX 5.2 (6) MAXTHREADS collides with a #define from on AIX (IBM compiler). Call it NDB_MAXTHREADS instead. Also explicitly #undef it here lest someone use it by habit and get really funny results. (K&R says we may #undef non-existent symbols.) --- config/ac-macros/large_file.m4 | 11 +++-------- configure.in | 6 ++++++ include/mysql.h | 4 ++++ ndb/src/common/util/File.cpp | 4 ++-- ndb/src/mgmclient/Makefile.am | 1 + ndb/src/mgmsrv/Makefile.am | 2 +- ndb/test/ndbapi/benchronja.cpp | 19 +++++++++++++------ ndb/test/ndbapi/flexAsynch.cpp | 19 +++++++++++++------ ndb/test/ndbapi/flexHammer.cpp | 15 +++++++++++---- ndb/test/ndbapi/flexScan.cpp | 11 +++++++++-- ndb/test/ndbapi/flexTT.cpp | 19 +++++++++++++------ ndb/test/ndbapi/flexTimedAsynch.cpp | 23 +++++++++++++++-------- ndb/test/ndbapi/initronja.cpp | 9 ++++++++- ndb/test/ndbapi/testOperations.cpp | 5 ----- ndb/test/ndbapi/testScanFilter.cpp | 12 ++++++++++-- ndb/test/odbc/SQL99_test/SQL99_test.cpp | 13 ++++++++++--- 16 files changed, 119 insertions(+), 54 deletions(-) diff --git a/config/ac-macros/large_file.m4 b/config/ac-macros/large_file.m4 index 00c2fdf614e..2639cec5fb7 100644 --- a/config/ac-macros/large_file.m4 +++ b/config/ac-macros/large_file.m4 @@ -127,14 +127,9 @@ AC_DEFUN([MYSQL_SYS_LARGEFILE], hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) ac_cv_sys_largefile_source=1 ;; esac]) - AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, - ac_cv_sys_large_files, - [Large files support on AIX-style hosts.], - [case "$host_os" in - # AIX 4.2 and later - aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*) - ac_cv_sys_large_files=1 ;; - esac]) + + # AIX 4.2 and later -- do nothing, include standards.h instead. + # this goes for both GNU and IBM C and C++ compilers. fi ]) diff --git a/configure.in b/configure.in index 1da39ac1aa3..a928bab236f 100644 --- a/configure.in +++ b/configure.in @@ -2890,6 +2890,12 @@ then ndb_opt_subdirs="$ndb_opt_subdirs docs" ndb_bin_am_ldflags="" fi +# building dynamic breaks on AIX. (If you want to try it and get unresolved +# __vec__delete2 and some such, try linking against libhC.) +case "$host_os" in + aix3.* | aix4.0.* | aix4.1.*) ;; + *) ndb_bin_am_ldflags="-static";; +esac AC_SUBST([ndb_bin_am_ldflags]) AC_SUBST([ndb_opt_subdirs]) diff --git a/include/mysql.h b/include/mysql.h index a153d0b51db..b3e0dc45496 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -27,6 +27,10 @@ #ifndef _mysql_h #define _mysql_h +#ifdef _AIX /* large-file support will break without this */ +#include +#endif + #ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */ #undef WIN #undef _WIN diff --git a/ndb/src/common/util/File.cpp b/ndb/src/common/util/File.cpp index a75fa5ae463..fe0fdfd1c91 100644 --- a/ndb/src/common/util/File.cpp +++ b/ndb/src/common/util/File.cpp @@ -50,7 +50,7 @@ File_class::size(FILE* f) MY_STAT s; // Note that my_fstat behaves *differently* than my_stat. ARGGGHH! - if(my_fstat(::fileno(f), &s, MYF(0))) + if(my_fstat(fileno(f), &s, MYF(0))) return 0; return s.st_size; @@ -196,7 +196,7 @@ File_class::flush() const { #if defined NDB_OSE || defined NDB_SOFTOSE ::fflush(m_file); - return ::fsync(::fileno(m_file)); + return ::fsync(fileno(m_file)); #else return ::fflush(m_file);; #endif diff --git a/ndb/src/mgmclient/Makefile.am b/ndb/src/mgmclient/Makefile.am index 99540160341..e1287532a07 100644 --- a/ndb/src/mgmclient/Makefile.am +++ b/ndb/src/mgmclient/Makefile.am @@ -36,6 +36,7 @@ INCLUDES += -I$(top_srcdir)/ndb/include/mgmapi \ LDADD_LOC = $(noinst_LTLIBRARIES) \ ../common/portlib/libportlib.la \ @readline_link@ \ + $(top_builddir)/ndb/src/libndbclient.la \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/strings/libmystrings.a \ diff --git a/ndb/src/mgmsrv/Makefile.am b/ndb/src/mgmsrv/Makefile.am index 88622c08e53..3d1845957e6 100644 --- a/ndb/src/mgmsrv/Makefile.am +++ b/ndb/src/mgmsrv/Makefile.am @@ -38,7 +38,7 @@ INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi \ -I$(top_srcdir)/ndb/src/common/mgmcommon \ -I$(top_srcdir)/ndb/src/mgmclient -LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CommandInterpreter.o \ +LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CommandInterpreter.lo \ $(top_builddir)/ndb/src/libndbclient.la \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/mysys/libmysys.a \ diff --git a/ndb/test/ndbapi/benchronja.cpp b/ndb/test/ndbapi/benchronja.cpp index 4973e6e2487..73ee324a888 100644 --- a/ndb/test/ndbapi/benchronja.cpp +++ b/ndb/test/ndbapi/benchronja.cpp @@ -41,7 +41,14 @@ #define MAXSTRLEN 16 #define MAXATTR 64 #define MAXTABLES 64 -#define MAXTHREADS 256 +#define NDB_MAXTHREADS 256 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS #define MAXATTRSIZE 8000 #define START_TIMER NdbTimer timer; timer.doStart(); #define STOP_TIMER timer.doStop(); @@ -56,18 +63,18 @@ struct ThreadNdb Ndb* NdbRef; }; -static NdbThread* threadLife[MAXTHREADS]; +static NdbThread* threadLife[NDB_MAXTHREADS]; static unsigned int tNoOfThreads; static unsigned int tNoOfOpsPerExecute; static unsigned int tNoOfRecords; static unsigned int tNoOfOperations; -static int ThreadReady[MAXTHREADS]; -static int ThreadStart[MAXTHREADS]; +static int ThreadReady[NDB_MAXTHREADS]; +static int ThreadStart[NDB_MAXTHREADS]; NDB_COMMAND(benchronja, "benchronja", "benchronja", "benchronja", 65535){ ndb_init(); - ThreadNdb tabThread[MAXTHREADS]; + ThreadNdb tabThread[NDB_MAXTHREADS]; int i = 0 ; int cont = 0 ; Ndb* pMyNdb = NULL ; //( "TEST_DB" ); @@ -84,7 +91,7 @@ NDB_COMMAND(benchronja, "benchronja", "benchronja", "benchronja", 65535){ { if (strcmp(argv[i], "-t") == 0){ tNoOfThreads = atoi(argv[i+1]); - if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)) goto error_input; + if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)) goto error_input; }else if (strcmp(argv[i], "-o") == 0){ tNoOfOperations = atoi(argv[i+1]); if (tNoOfOperations < 1) goto error_input; diff --git a/ndb/test/ndbapi/flexAsynch.cpp b/ndb/test/ndbapi/flexAsynch.cpp index 20a157fc2f3..1f52315482f 100644 --- a/ndb/test/ndbapi/flexAsynch.cpp +++ b/ndb/test/ndbapi/flexAsynch.cpp @@ -35,7 +35,14 @@ #define MAXSTRLEN 16 #define MAXATTR 64 #define MAXTABLES 64 -#define MAXTHREADS 128 +#define NDB_MAXTHREADS 128 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS #define MAXPAR 1024 #define MAXATTRSIZE 1000 #define PKSIZE 2 @@ -76,10 +83,10 @@ struct ThreadNdb int ThreadNo; }; -static NdbThread* threadLife[MAXTHREADS]; +static NdbThread* threadLife[NDB_MAXTHREADS]; static int tNodeId; -static int ThreadReady[MAXTHREADS]; -static StartType ThreadStart[MAXTHREADS]; +static int ThreadReady[NDB_MAXTHREADS]; +static StartType ThreadStart[NDB_MAXTHREADS]; static char tableName[MAXTABLES][MAXSTRLEN+1]; static char attrName[MAXATTR][MAXSTRLEN+1]; @@ -160,7 +167,7 @@ NDB_COMMAND(flexAsynch, "flexAsynch", "flexAsynch", "flexAsynch", 65535) return NDBT_ProgramExit(NDBT_WRONGARGS); } - pThreadData = new ThreadNdb[MAXTHREADS]; + pThreadData = new ThreadNdb[NDB_MAXTHREADS]; ndbout << endl << "FLEXASYNCH - Starting normal mode" << endl; ndbout << "Perform benchmark of insert, update and delete transactions"; @@ -844,7 +851,7 @@ readArguments(int argc, const char** argv){ while (argc > 1){ if (strcmp(argv[i], "-t") == 0){ tNoOfThreads = atoi(argv[i+1]); - if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)){ + if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)){ ndbout_c("Invalid no of threads"); return -1; } diff --git a/ndb/test/ndbapi/flexHammer.cpp b/ndb/test/ndbapi/flexHammer.cpp index 9abac905f5a..3847bc38b35 100644 --- a/ndb/test/ndbapi/flexHammer.cpp +++ b/ndb/test/ndbapi/flexHammer.cpp @@ -69,7 +69,14 @@ ErrorData * flexHammerErrorData; #define MAXSTRLEN 16 #define MAXATTR 64 #define MAXTABLES 64 -#define MAXTHREADS 256 +#define NDB_MAXTHREADS 256 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS #define MAXATTRSIZE 100 // Max number of retries if something fails #define MaxNoOfAttemptsC 10 @@ -122,8 +129,8 @@ static int tAttributeSize; static int tNoOfOperations; static int tNoOfRecords; static int tNoOfLoops; -static ReadyType ThreadReady[MAXTHREADS]; -static StartType ThreadStart[MAXTHREADS]; +static ReadyType ThreadReady[NDB_MAXTHREADS]; +static StartType ThreadStart[NDB_MAXTHREADS]; static char tableName[MAXTABLES][MAXSTRLEN]; static char attrName[MAXATTR][MAXSTRLEN]; static int theSimpleFlag = 0; @@ -643,7 +650,7 @@ readArguments (int argc, const char** argv) while (argc > 1) { if (strcmp(argv[i], "-t") == 0) { tNoOfThreads = atoi(argv[i+1]); - if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)) + if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)) return(1); } else if (strcmp(argv[i], "-o") == 0) { diff --git a/ndb/test/ndbapi/flexScan.cpp b/ndb/test/ndbapi/flexScan.cpp index cbea90f44f4..4e3def7fb91 100644 --- a/ndb/test/ndbapi/flexScan.cpp +++ b/ndb/test/ndbapi/flexScan.cpp @@ -68,7 +68,14 @@ #define MAXSTRLEN 16 #define MAXATTR 64 #define MAXTABLES 64 -#define MAXTHREADS 256 +#define NDB_MAXTHREADS 256 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS #define MAXATTRSIZE 64 enum StartType { @@ -860,7 +867,7 @@ static int readArguments(int argc, const char** argv) if (strcmp(argv[i], "-t") == 0) { if (argv[i + 1] != NULL) { tNoOfThreads = atoi(argv[i + 1]); - if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)) { + if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)) { retValue = -1; } // if } // if diff --git a/ndb/test/ndbapi/flexTT.cpp b/ndb/test/ndbapi/flexTT.cpp index 71d5b6c096e..4373102f77e 100644 --- a/ndb/test/ndbapi/flexTT.cpp +++ b/ndb/test/ndbapi/flexTT.cpp @@ -35,7 +35,14 @@ #define MAXSTRLEN 16 #define MAXATTR 64 #define MAXTABLES 64 -#define MAXTHREADS 128 +#define NDB_MAXTHREADS 128 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS #define MAXPAR 1024 #define MAXATTRSIZE 1000 #define PKSIZE 1 @@ -101,10 +108,10 @@ static void input_error(); ErrorData * flexTTErrorData; -static NdbThread* threadLife[MAXTHREADS]; +static NdbThread* threadLife[NDB_MAXTHREADS]; static int tNodeId; -static int ThreadReady[MAXTHREADS]; -static StartType ThreadStart[MAXTHREADS]; +static int ThreadReady[NDB_MAXTHREADS]; +static StartType ThreadStart[NDB_MAXTHREADS]; static char tableName[1][MAXSTRLEN+1]; static char attrName[5][MAXSTRLEN+1]; @@ -184,7 +191,7 @@ NDB_COMMAND(flexTT, "flexTT", "flexTT", "flexTT", 65535) return NDBT_ProgramExit(NDBT_WRONGARGS); } - pThreadData = new ThreadNdb[MAXTHREADS]; + pThreadData = new ThreadNdb[NDB_MAXTHREADS]; ndbout << endl << "FLEXTT - Starting normal mode" << endl; ndbout << "Perform TimesTen benchmark" << endl; @@ -798,7 +805,7 @@ readArguments(int argc, const char** argv){ while (argc > 1){ if (strcmp(argv[i], "-t") == 0){ tNoOfThreads = atoi(argv[i+1]); - if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)){ + if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)){ ndbout_c("Invalid no of threads"); return -1; } diff --git a/ndb/test/ndbapi/flexTimedAsynch.cpp b/ndb/test/ndbapi/flexTimedAsynch.cpp index cc44ab8b237..b6301e59df2 100644 --- a/ndb/test/ndbapi/flexTimedAsynch.cpp +++ b/ndb/test/ndbapi/flexTimedAsynch.cpp @@ -57,7 +57,14 @@ #define MAXSTRLEN 16 #define MAXATTR 64 #define MAXTABLES 64 -#define MAXTHREADS 256 +#define NDB_MAXTHREADS 256 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS #define MAXATTRSIZE 1000 #define PKSIZE 1 @@ -95,10 +102,10 @@ static int failed = 0 ; // lame global variable that keeps track of failed trans // incremented in executeCallback() and reset in main() /************************************************************* < epaulsa */ -static NdbThread* threadLife[MAXTHREADS]; +static NdbThread* threadLife[NDB_MAXTHREADS]; static int tNodeId; -static int ThreadReady[MAXTHREADS]; -static StartType ThreadStart[MAXTHREADS]; +static int ThreadReady[NDB_MAXTHREADS]; +static StartType ThreadStart[NDB_MAXTHREADS]; static char tableName[MAXTABLES][MAXSTRLEN+1]; static char attrName[MAXATTR][MAXSTRLEN+1]; static int *getAttrValueTable; @@ -174,7 +181,7 @@ void deleteAttributeSpace(){ NDB_COMMAND(flexTimedAsynch, "flexTimedAsynch", "flexTimedAsynch [-tpoilcas]", "flexTimedAsynch", 65535) { ndb_init(); - ThreadNdb tabThread[MAXTHREADS]; + ThreadNdb tabThread[NDB_MAXTHREADS]; int tLoops=0; int returnValue; //NdbOut flexTimedAsynchNdbOut; @@ -615,8 +622,8 @@ void readArguments(int argc, const char** argv) if (strcmp(argv[i], "-t") == 0) { tNoOfThreads = atoi(argv[i+1]); - // if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)) - if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)) + // if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)) + if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)) exit(-1); } else if (strcmp(argv[i], "-i") == 0) @@ -628,7 +635,7 @@ void readArguments(int argc, const char** argv) else if (strcmp(argv[i], "-p") == 0) { tNoOfTransInBatch = atoi(argv[i+1]); - //if ((tNoOfTransInBatch < 1) || (tNoOfTransInBatch > MAXTHREADS)) + //if ((tNoOfTransInBatch < 1) || (tNoOfTransInBatch > NDB_MAXTHREADS)) if ((tNoOfTransInBatch < 1) || (tNoOfTransInBatch > 10000)) exit(-1); } diff --git a/ndb/test/ndbapi/initronja.cpp b/ndb/test/ndbapi/initronja.cpp index 63bbc374c62..f48b1c86da3 100644 --- a/ndb/test/ndbapi/initronja.cpp +++ b/ndb/test/ndbapi/initronja.cpp @@ -29,7 +29,14 @@ #define MAXSTRLEN 16 #define MAXATTR 64 #define MAXTABLES 64 -#define MAXTHREADS 256 +#define NDB_MAXTHREADS 256 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS #define MAXATTRSIZE 8000 static unsigned int tNoOfRecords; diff --git a/ndb/test/ndbapi/testOperations.cpp b/ndb/test/ndbapi/testOperations.cpp index 1f610cade4a..21151ab5c7f 100644 --- a/ndb/test/ndbapi/testOperations.cpp +++ b/ndb/test/ndbapi/testOperations.cpp @@ -97,11 +97,6 @@ OperationTestCase matrix[] = { result = NDBT_FAILED; \ break; } -#define C3(b) if (!(b)) { \ - g_err << "ERR: "<< step->getName() \ - << " failed on line " << __LINE__ << endl; \ - abort(); return NDBT_FAILED; } - #define C3(b) if (!(b)) { \ g_err << "ERR: failed on line " << __LINE__ << endl; \ return NDBT_FAILED; } diff --git a/ndb/test/ndbapi/testScanFilter.cpp b/ndb/test/ndbapi/testScanFilter.cpp index 5098d83745b..81aa6b82fa0 100644 --- a/ndb/test/ndbapi/testScanFilter.cpp +++ b/ndb/test/ndbapi/testScanFilter.cpp @@ -49,7 +49,15 @@ const char COL_LEN = 7; * there are six columns, 'i', 'j', 'k', 'l', 'm', 'n', and each on is equal to 1 or 1, * Since each tuple should be unique in this case, then TUPLE_NUM = 2 power 6 = 64 */ -const int TUPLE_NUM = (int)pow(2, COL_LEN-1); +#ifdef _AIX +/* + IBM xlC_r breaks on the initialization with pow(): + "The expression must be an integral constant expression." +*/ +const int TUPLE_NUM = 64; +#else +const int TUPLE_NUM = (int)pow(2, COL_LEN-1); +#endif /* * the recursive level of random scan filter, can @@ -479,7 +487,7 @@ int get_column_id(char ch) */ bool check_col_equal_one(int tuple_no, int col_id) { - int i = (int)pow(2, 6 - col_id); + int i = (int)pow((double)2, (double)(6 - col_id)); int j = tuple_no / i; if(j % 2) return true; diff --git a/ndb/test/odbc/SQL99_test/SQL99_test.cpp b/ndb/test/odbc/SQL99_test/SQL99_test.cpp index 039a77f4d53..fb77220773d 100644 --- a/ndb/test/odbc/SQL99_test/SQL99_test.cpp +++ b/ndb/test/odbc/SQL99_test/SQL99_test.cpp @@ -27,7 +27,14 @@ using namespace std; // #define MAXROW 64 #define DEFROW 8 -#define MAXTHREADS 24 +/* + NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a + #define from on AIX (IBM compiler). We explicitly + #undef it here lest someone use it by habit and get really funny + results. K&R says we may #undef non-existent symbols, so let's go. +*/ +#undef MAXTHREADS +#define NDB_MAXTHREADS 24 #define DEFTHREADS 2 #define MAXTABLES 16 @@ -83,7 +90,7 @@ int main(int argc, char* argv[]){ char* szTableNames = (char*)malloc(sizeof(char)*nNoOfTables*MAX_TABLE_NAME) ; memset(szTableNames, 0, sizeof(char)*nNoOfTables*MAX_TABLE_NAME) ; - UintPtr pThreadHandles[MAXTHREADS] = { NULL } ; + UintPtr pThreadHandles[NDB_MAXTHREADS] = { NULL } ; AssignTableNames(szTableNames, nNoOfTables) ; @@ -313,7 +320,7 @@ void ParseArguments(int argc, const char** argv){ if (strcmp(argv[i], "-t") == 0) { nNoOfThreads = atoi(argv[i+1]); - if ((nNoOfThreads < 1) || (nNoOfThreads > MAXTHREADS)) + if ((nNoOfThreads < 1) || (nNoOfThreads > NDB_MAXTHREADS)) nNoOfThreads = DEFTHREADS ; } else if (strcmp(argv[i], "-c") == 0) From 1281fbc58c139b90a329ae3519f46d2b0b75a249 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Aug 2007 11:41:13 +0500 Subject: [PATCH 45/49] Fix for bug #30088: Can't disable myisam-recover by a value of "". - test result. Problem: we don't proper handle "" value of the --myisam-recover option. Fix: turn off myisam recovering if --myisam-recover="" is set. mysql-test/r/show_check.result: Fix for bug #30088: Can't disable myisam-recover by a value of "". - test result. mysql-test/t/show_check-master.opt: Fix for bug #30088: Can't disable myisam-recover by a value of "". - test case. mysql-test/t/show_check.test: Fix for bug #30088: Can't disable myisam-recover by a value of "". - test case. sql/mysqld.cc: Fix for bug #30088: Can't disable myisam-recover by a value of "". - turn off myisam recovering if --myisam-recover="" is passed. --- mysql-test/r/show_check.result | 3 +++ mysql-test/t/show_check-master.opt | 2 +- mysql-test/t/show_check.test | 5 +++++ sql/mysqld.cc | 7 ++++++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index e4cdd4f183b..85528de00bc 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -1118,4 +1118,7 @@ select 1 from information_schema.tables limit 1; show status like 'slow_queries'; Variable_name Value Slow_queries 2 +show variables like 'myisam_recover_options'; +Variable_name Value +myisam_recover_options OFF End of 5.0 tests diff --git a/mysql-test/t/show_check-master.opt b/mysql-test/t/show_check-master.opt index 3eb98fc3d6b..7a438da06cc 100644 --- a/mysql-test/t/show_check-master.opt +++ b/mysql-test/t/show_check-master.opt @@ -1 +1 @@ ---log-slow-queries --log-long-format --log-queries-not-using-indexes +--log-slow-queries --log-long-format --log-queries-not-using-indexes --myisam-recover="" diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index a58d81a414b..28f85635c93 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -782,4 +782,9 @@ show variables like "log_queries_not_using_indexes"; select 1 from information_schema.tables limit 1; show status like 'slow_queries'; +# +# Bug #30088: Can't disable myisam-recover by a value of "" +# +show variables like 'myisam_recover_options'; + --echo End of 5.0 tests diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9eb3d157dcf..57d1656736d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7241,11 +7241,16 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), #endif /* HAVE_INNOBASE_DB */ case OPT_MYISAM_RECOVER: { - if (!argument || !argument[0]) + if (!argument) { myisam_recover_options= HA_RECOVER_DEFAULT; myisam_recover_options_str= myisam_recover_typelib.type_names[0]; } + else if (!argument[0]) + { + myisam_recover_options= HA_RECOVER_NONE; + myisam_recover_options_str= "OFF"; + } else { myisam_recover_options_str=argument; From 25723542a1ffcd3365b51a48bbab0e238306ab2a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Aug 2007 12:28:08 +0400 Subject: [PATCH 46/49] Fix an unstable test. It was reliant on the current time. mysql-test/r/func_time.result: Update results (use fixed datetime values instead of NOW()). mysql-test/t/func_time.test: Use fixed datetime values instead of NOW(): the test would have a sporadic failure when current day changed between two consequtive calls to NOW(). The test actually tests FROM_DAYS/TO_DAYS functions, so use of NOW() is not necessary. --- mysql-test/r/func_time.result | 8 ++++---- mysql-test/t/func_time.test | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 56ea72a8ee3..f92ecac329a 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -840,11 +840,11 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname(_latin1'1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)` -SET @TMP=NOW(); +SET @TMP='2007-08-01 12:22:49'; CREATE TABLE t1 (d DATETIME); -INSERT INTO t1 VALUES (NOW()); -INSERT INTO t1 VALUES (NOW()); -INSERT INTO t1 VALUES (NOW()); +INSERT INTO t1 VALUES ('2007-08-01 12:22:59'); +INSERT INTO t1 VALUES ('2007-08-01 12:23:01'); +INSERT INTO t1 VALUES ('2007-08-01 12:23:20'); SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAYS(@TMP)+1); count(*) 3 diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index da909dc578f..4f35a681228 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -423,11 +423,11 @@ select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0; explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_days(to_days("960101")),dayofmonth("1997-01-02"), month("1997-01-02"), monthname("1972-03-04"),dayofyear("0000-00-00"),HOUR("1997-03-03 23:03:22"),MINUTE("23:03:22"),SECOND(230322),QUARTER(980303),WEEK("1998-03-03"),yearweek("2000-01-01",1),week(19950101,1),year("98-02-03"),weekday(curdate())-weekday(now()),dayname("1962-03-03"),unix_timestamp(),sec_to_time(time_to_sec("0:30:47")/6.21),curtime(),utc_time(),curdate(),utc_date(),utc_timestamp(),date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"),from_unixtime(unix_timestamp("1994-03-02 10:11:12")),"1997-12-31 23:59:59" + INTERVAL 1 SECOND,"1998-01-01 00:00:00" - INTERVAL 1 SECOND,INTERVAL 1 DAY + "1997-12-31", extract(YEAR FROM "1999-01-02 10:11:12"),date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND); -SET @TMP=NOW(); +SET @TMP='2007-08-01 12:22:49'; CREATE TABLE t1 (d DATETIME); -INSERT INTO t1 VALUES (NOW()); -INSERT INTO t1 VALUES (NOW()); -INSERT INTO t1 VALUES (NOW()); +INSERT INTO t1 VALUES ('2007-08-01 12:22:59'); +INSERT INTO t1 VALUES ('2007-08-01 12:23:01'); +INSERT INTO t1 VALUES ('2007-08-01 12:23:20'); SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAYS(@TMP)+1); DROP TABLE t1; From c517fea540967e3922128a33a81bbdf7318285e1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Aug 2007 11:58:25 +0200 Subject: [PATCH 47/49] Option 6 tries to grant global privileges at the database level which does not work. Removing these attempted privileges makes this identical to option 5 so remove it completely. The spirit of the program appears to be aimed at database privileges, so do not add another option for granting global privileges as it may be unexpected. Fixes bug#14618 (same as previous patch, this time applied to -maint tree). scripts/mysql_setpermission.sh: Option 6 tries to apply global privileges at the database level which does not work - remove it. --- scripts/mysql_setpermission.sh | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/scripts/mysql_setpermission.sh b/scripts/mysql_setpermission.sh index 9699cd28047..1f5509f9955 100644 --- a/scripts/mysql_setpermission.sh +++ b/scripts/mysql_setpermission.sh @@ -19,13 +19,14 @@ ## 1.3 Applied patch provided by Martin Mokrejs ## (General code cleanup, use the GRANT statement instead of updating ## the privilege tables directly, added option to revoke privileges) +## 1.4 Remove option 6 which attempted to erroneously grant global privileges #### TODO # # empty ... suggestions ... mail them to me ... -$version="1.3"; +$version="1.4"; use DBI; use Getopt::Long; @@ -103,13 +104,9 @@ sub q1 { # first question ... print " existing database and host combination (user can do\n"; print " SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,\n"; print " LOCK TABLES,CREATE TEMPORARY TABLES)\n"; - print " 6. Create/append database administrative privileges for an\n"; - print " existing database and host combination (user can do\n"; - print " SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,\n"; - print " CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS)\n"; - print " 7. Create/append full privileges for an existing database\n"; + print " 6. Create/append full privileges for an existing database\n"; print " and host combination (user has FULL privilege)\n"; - print " 8. Remove all privileges for for an existing database and\n"; + print " 7. Remove all privileges for for an existing database and\n"; print " host combination.\n"; print " (user will have all permission fields set to N)\n"; print " 0. exit this program\n"; @@ -117,10 +114,10 @@ sub q1 { # first question ... while () { $answer = $_; chomp($answer); - if ($answer =~ /^[12345678]$/) { + if ($answer =~ /^[1234567]$/) { if ($answer == 1) { setpwd(); - } elsif ($answer =~ /^[2345678]$/) { + } elsif ($answer =~ /^[234567]$/) { addall($answer); } else { print "Sorry, something went wrong. With such option number you should not get here.\n\n"; @@ -233,7 +230,7 @@ sub addall { } } - if ( ( !$todo ) or not ( $todo =~ m/^[2-8]$/ ) ) { + if ( ( !$todo ) or not ( $todo =~ m/^[2-7]$/ ) ) { print STDERR "Sorry, select option $todo isn't known inside the program .. See ya\n"; quit(); } @@ -256,12 +253,9 @@ sub addall { # user privileges: SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES $sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr; } elsif ($todo == 6) { - # admin privileges: GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS - $sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr; - } elsif ($todo == 7) { # all privileges $sth = $dbh->do("GRANT ALL ON $db.* TO \'$user\'\@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr; - } elsif ($todo == 8) { + } elsif ($todo == 7) { # all privileges set to N $sth = $dbh->do("REVOKE ALL ON *.* FROM \'$user\'\@\'$host\'") || die $dbh->errstr; } From f87acb594a15b415b58a3053e76bfd1b27a6d594 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Aug 2007 15:27:03 +0500 Subject: [PATCH 48/49] Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out Problem: using "mysqlbinlog | mysql" for recoveries the connection_id() result may differ from what was used when issuing the statement. Fix: if there is a connection_id() in a statement, write to binlog SET pseudo_thread_id= XXX; before it and use the value later on. mysql-test/r/mysqlbinlog.result: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - test result. mysql-test/t/mysqlbinlog.test: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - test case. sql/item_create.cc: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - set thread_specific_used flag for the connection_id() function. sql/item_func.cc: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - always return thd->variables.pseudo_thread_id as a connection_id() result, as it contains a proper value for both master and slave. sql/log_event.cc: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - set LOG_EVENT_THREAD_SPECIFIC_F event flag if thread_specific_used is set. sql/sql_class.cc: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - thd->thread_specific_used introduced, which is set if thread specific value(s) used in a statement. sql/sql_class.h: Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect restores from mysqlbinlog out - thd->thread_specific_used introduced, which is set if thread specific value(s) used in a statement. --- mysql-test/r/mysqlbinlog.result | 7 +++++++ mysql-test/t/mysqlbinlog.test | 21 +++++++++++++++++++++ sql/item_create.cc | 4 +++- sql/item_func.cc | 11 +---------- sql/log_event.cc | 11 +++++++---- sql/sql_class.cc | 2 +- sql/sql_class.h | 3 +++ 7 files changed, 43 insertions(+), 16 deletions(-) diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 1ba198dfd75..d16a4c39a11 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -318,4 +318,11 @@ INSERT INTO t1 VALUES ('0123456789'); flush logs; DROP TABLE t1; # Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED +flush logs; +create table t1(a int); +insert into t1 values(connection_id()); +flush logs; +drop table t1; +1 +drop table t1; End of 5.0 tests diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index bd90dcfb930..451eef17108 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -216,4 +216,25 @@ flush logs; DROP TABLE t1; --exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g' +# +# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out +# +flush logs; +create table t1(a int); +insert into t1 values(connection_id()); +let $a= `select a from t1`; +flush logs; +--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000013 > $MYSQLTEST_VARDIR/tmp/bug29928.sql +drop table t1; +connect (con1, localhost, root, , test); +connection con1; +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29928.sql +--remove_file $MYSQLTEST_VARDIR/tmp/bug29928.sql +let $b= `select a from t1`; +disconnect con1; +connection default; +let $c= `select $a=$b`; +--echo $c +drop table t1; + --echo End of 5.0 tests diff --git a/sql/item_create.cc b/sql/item_create.cc index 50db1c37371..3713fc9e380 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -70,7 +70,9 @@ Item *create_func_ceiling(Item* a) Item *create_func_connection_id(void) { - current_thd->lex->safe_to_cache_query= 0; + THD *thd= current_thd; + thd->lex->safe_to_cache_query= 0; + thd->thread_specific_used= TRUE; return new Item_func_connection_id(); } diff --git a/sql/item_func.cc b/sql/item_func.cc index b256ce4624a..cada6019ffd 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -649,16 +649,7 @@ bool Item_func_connection_id::fix_fields(THD *thd, Item **ref) { if (Item_int_func::fix_fields(thd, ref)) return TRUE; - - /* - To replicate CONNECTION_ID() properly we should use - pseudo_thread_id on slave, which contains the value of thread_id - on master. - */ - value= ((thd->slave_thread) ? - thd->variables.pseudo_thread_id : - thd->thread_id); - + value= thd->variables.pseudo_thread_id; return FALSE; } diff --git a/sql/log_event.cc b/sql/log_event.cc index c37df31ae00..1ef765f607f 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1303,8 +1303,9 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length, bool using_trans, bool suppress_use, THD::killed_state killed_status_arg) :Log_event(thd_arg, - ((thd_arg->tmp_table_used ? LOG_EVENT_THREAD_SPECIFIC_F : 0) - | (suppress_use ? LOG_EVENT_SUPPRESS_USE_F : 0)), + ((thd_arg->tmp_table_used || thd_arg->thread_specific_used) ? + LOG_EVENT_THREAD_SPECIFIC_F : 0) | + (suppress_use ? LOG_EVENT_SUPPRESS_USE_F : 0), using_trans), data_buf(0), query(query_arg), catalog(thd_arg->catalog), db(thd_arg->db), q_len((uint32) query_length), @@ -2689,8 +2690,10 @@ Load_log_event::Load_log_event(THD *thd_arg, sql_exchange *ex, List &fields_arg, enum enum_duplicates handle_dup, bool ignore, bool using_trans) - :Log_event(thd_arg, !thd_arg->tmp_table_used ? - 0 : LOG_EVENT_THREAD_SPECIFIC_F, using_trans), + :Log_event(thd_arg, + (thd_arg->tmp_table_used || thd_arg->thread_specific_used) ? + LOG_EVENT_THREAD_SPECIFIC_F : 0, + using_trans), thread_id(thd_arg->thread_id), slave_proxy_id(thd_arg->variables.pseudo_thread_id), num_fields(0),fields(0), diff --git a/sql/sql_class.cc b/sql/sql_class.cc index ee4e1ea149c..c4fc82e55ca 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -197,7 +197,7 @@ THD::THD() count_cuted_fields= CHECK_FIELD_IGNORE; killed= NOT_KILLED; db_length= col_access=0; - query_error= tmp_table_used= 0; + query_error= tmp_table_used= thread_specific_used= 0; next_insert_id=last_insert_id=0; hash_clear(&handler_tables_hash); tmp_table=0; diff --git a/sql/sql_class.h b/sql/sql_class.h index 445a3ce437c..49f3e6354b9 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1457,6 +1457,9 @@ public: bool in_lock_tables; bool query_error, bootstrap, cleanup_done; bool tmp_table_used; + + /** is set if some thread specific value(s) used in a statement. */ + bool thread_specific_used; bool charset_is_system_charset, charset_is_collation_connection; bool charset_is_character_set_filesystem; bool enable_slow_log; /* enable slow log for current statement */ From 898333f843b5c750b9863ea94d60ab81a9caca4e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Aug 2007 14:51:03 +0500 Subject: [PATCH 49/49] Fix for bug #30200: mysqlbinlog.test: connection_id() not restored under ps-protocol Problem: thd->thread_specific_used flag is not set executing a statement containig connection_id() function using PS protocol, that leads to improper binlog event creation. Fix: set the flag in the Item_func_connection_id::fix_fields(). sql/item_create.cc: Fix for bug #30200: mysqlbinlog.test: connection_id() not restored under ps-protocol - set the thd->thread_specific_used flag in the Item_func_connection_id::fix_fields() to have it properly set using PS protocol as well. sql/item_func.cc: Fix for bug #30200: mysqlbinlog.test: connection_id() not restored under ps-protocol - set the thd->thread_specific_used flag in the Item_func_connection_id::fix_fields() to have it properly set using PS protocol as well. sql/sql_parse.cc: Fix for bug #30200: mysqlbinlog.test: connection_id() not restored under ps-protocol - reset the thd->thread_specific_used flag in the mysql_reset_thd_for_next_command(). --- sql/item_create.cc | 1 - sql/item_func.cc | 1 + sql/sql_parse.cc | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/item_create.cc b/sql/item_create.cc index 3713fc9e380..561613032bc 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -72,7 +72,6 @@ Item *create_func_connection_id(void) { THD *thd= current_thd; thd->lex->safe_to_cache_query= 0; - thd->thread_specific_used= TRUE; return new Item_func_connection_id(); } diff --git a/sql/item_func.cc b/sql/item_func.cc index 4b32281b457..c70cfa1ce2a 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -649,6 +649,7 @@ bool Item_func_connection_id::fix_fields(THD *thd, Item **ref) { if (Item_int_func::fix_fields(thd, ref)) return TRUE; + thd->thread_specific_used= TRUE; value= thd->variables.pseudo_thread_id; return FALSE; } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7d723d3cd5b..25ead88ac53 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5847,6 +5847,7 @@ void mysql_reset_thd_for_next_command(THD *thd) SERVER_QUERY_NO_GOOD_INDEX_USED); DBUG_ASSERT(thd->security_ctx== &thd->main_security_ctx); thd->tmp_table_used= 0; + thd->thread_specific_used= FALSE; if (!thd->in_sub_stmt) { if (opt_bin_log)