From ca484c1750b78728ed79f95c52905c7848557914 Mon Sep 17 00:00:00 2001 From: shizhao Date: Tue, 25 Oct 2022 07:48:54 +0000 Subject: [PATCH] test(mtr): Add update_signed.test and delete_signed.test(#497) --- .../suite/tianmu/r/delete_signed.result | 380 ++++++++++++ .../suite/tianmu/r/update_signed.result | 540 ++++++++++++++++++ mysql-test/suite/tianmu/t/delete_signed.test | 201 +++++++ mysql-test/suite/tianmu/t/update_signed.test | 200 +++++++ 4 files changed, 1321 insertions(+) create mode 100644 mysql-test/suite/tianmu/r/delete_signed.result create mode 100644 mysql-test/suite/tianmu/r/update_signed.result create mode 100644 mysql-test/suite/tianmu/t/delete_signed.test create mode 100644 mysql-test/suite/tianmu/t/update_signed.test diff --git a/mysql-test/suite/tianmu/r/delete_signed.result b/mysql-test/suite/tianmu/r/delete_signed.result new file mode 100644 index 0000000000..42225c0698 --- /dev/null +++ b/mysql-test/suite/tianmu/r/delete_signed.result @@ -0,0 +1,380 @@ +# +# DELETE decimal and DElETE WHERE +# +DROP DATABASE IF EXISTS delete_signed_test; +CREATE DATABASE delete_signed_test; +USE delete_signed_test; +DROP PROCEDURE IF EXISTS signedinsertproc; +DROP PROCEDURE IF EXISTS signeddeleteproc; +CREATE PROCEDURE signedinsertproc () +BEGIN +INSERT INTO cs1 VALUES (125, 125); +INSERT INTO cs1 VALUES (-125, -125); +INSERT INTO cs1 values (99998, 998); +INSERT INTO cs1 values (99999, 999); +INSERT INTO cs1 values (-99998, -998); +INSERT INTO cs1 values (-99999, -999); +INSERT INTO cs1 VALUES (0, 0); +INSERT INTO cs1 VALUES (NULL, NULL); +INSERT INTO cs2 VALUES (1.25, 1.25); +INSERT INTO cs2 VALUES (-1.25, -1.25); +INSERT INTO cs2 values (99999.998, 99999.998); +INSERT INTO cs2 values (99999.999, 99999.999); +INSERT INTO cs2 values (-99999.998, -99999.998); +INSERT INTO cs2 values (-99999.999, -99999.999); +INSERT INTO cs2 VALUES (1.1234567891, 1.1234567891); +INSERT INTO cs2 VALUES (1.999, 1.999); +INSERT INTO cs2 VALUES (-1.1234567891, -1.1234567891); +INSERT INTO cs2 VALUES (-1.999, -1.999); +INSERT INTO cs2 VALUES (1.0000000009, 1.0000000009); +INSERT INTO cs2 VALUES (-1.0000000009, -1.0000000009); +INSERT INTO cs2 VALUES (0, 0); +INSERT INTO cs2 VALUES (NULL, NULL); +INSERT INTO cs3 VALUES (0.125, 0.125); +INSERT INTO cs3 VALUES (-0.125, -0.125); +INSERT INTO cs3 values (0.99998, 0.998); +INSERT INTO cs3 values (0.99999, 0.999); +INSERT INTO cs3 values (-0.99998, -0.998); +INSERT INTO cs3 values (-0.99999, -0.999); +INSERT INTO cs3 VALUES (0.12345, 0.1234); +INSERT INTO cs3 VALUES (0.199999, 0.19999); +INSERT INTO cs3 VALUES (-0.12345, -0.1234); +INSERT INTO cs3 VALUES (-0.199999, -0.19999); +INSERT INTO cs3 VALUES (0.000009, 0.00009); +INSERT INTO cs3 VALUES (-0.000009, -0.00009); +INSERT INTO cs3 VALUES (0, 0); +INSERT INTO cs3 VALUES (NULL, NULL); +END// +CREATE PROCEDURE signeddeleteproc () +BEGIN +DELETE FROM cs1; +DELETE FROM cs2; +DELETE FROM cs3; +END// +DROP TABLE IF EXISTS cs1; +DROP TABLE IF EXISTS cs2; +DROP TABLE IF EXISTS cs3; +CREATE TABLE cs1 (d1 DECIMAL(18), d2 DECIMAL(18)) ; +CREATE TABLE cs2 (d1 DECIMAL(18,10), d2 DECIMAL(18,10)) ; +CREATE TABLE cs3 (d1 DECIMAL(18,10), d2 DECIMAL(18,10)) ; +CALL signedinsertproc(); +DELETE FROM cs1; +DELETE FROM cs2; +DELETE FROM cs3; +SELECT "signedtest1", d1, d2 FROM cs1; +signedtest1 d1 d2 +SELECT "signedtest1", d1, d2 FROM cs2; +signedtest1 d1 d2 +SELECT "signedtest1", d1, d2 FROM cs3; +signedtest1 d1 d2 +CALL signedinsertproc(); +DELETE FROM cs1 WHERE d1=-99998; +DELETE FROM cs1 WHERE d2=999; +DELETE FROM cs2 WHERE d1=-99999.998; +DELETE FROM cs2 WHERE d2=99999.999; +DELETE FROM cs3 WHERE d1=-0.99998; +DELETE FROM cs3 WHERE d2=0.999; +SELECT "signedtest2", d1, d2 FROM cs1; +signedtest2 d1 d2 +signedtest2 125 125 +signedtest2 -125 -125 +signedtest2 99998 998 +signedtest2 -99999 -999 +signedtest2 0 0 +signedtest2 NULL NULL +SELECT "signedtest2", d1, d2 FROM cs2; +signedtest2 d1 d2 +signedtest2 1.2500000000 1.2500000000 +signedtest2 -1.2500000000 -1.2500000000 +signedtest2 99999.9980000000 99999.9980000000 +signedtest2 -99999.9990000000 -99999.9990000000 +signedtest2 1.1234567891 1.1234567891 +signedtest2 1.9990000000 1.9990000000 +signedtest2 -1.1234567891 -1.1234567891 +signedtest2 -1.9990000000 -1.9990000000 +signedtest2 1.0000000009 1.0000000009 +signedtest2 -1.0000000009 -1.0000000009 +signedtest2 0.0000000000 0.0000000000 +signedtest2 NULL NULL +SELECT "signedtest2", d1, d2 FROM cs3; +signedtest2 d1 d2 +signedtest2 0.1250000000 0.1250000000 +signedtest2 -0.1250000000 -0.1250000000 +signedtest2 0.9999800000 0.9980000000 +signedtest2 -0.9999900000 -0.9990000000 +signedtest2 0.1234500000 0.1234000000 +signedtest2 0.1999990000 0.1999900000 +signedtest2 -0.1234500000 -0.1234000000 +signedtest2 -0.1999990000 -0.1999900000 +signedtest2 0.0000090000 0.0000900000 +signedtest2 -0.0000090000 -0.0000900000 +signedtest2 0.0000000000 0.0000000000 +signedtest2 NULL NULL +CALL signeddeleteproc(); +CALL signedinsertproc(); +DELETE FROM cs1 WHERE d1 <= -99998 OR d2 >= 998; +DELETE FROM cs2 WHERE d1 <= -99999.998 OR d2 >= 99999.998; +DELETE FROM cs3 WHERE d1 <= -0.99998 OR d2 >= 0.998; +SELECT "signedtest4a", d1, d2 FROM cs1; +signedtest4a d1 d2 +signedtest4a 125 125 +signedtest4a -125 -125 +signedtest4a 0 0 +signedtest4a NULL NULL +SELECT "signedtest4a", d1, d2 FROM cs2; +signedtest4a d1 d2 +signedtest4a 1.2500000000 1.2500000000 +signedtest4a -1.2500000000 -1.2500000000 +signedtest4a 1.1234567891 1.1234567891 +signedtest4a 1.9990000000 1.9990000000 +signedtest4a -1.1234567891 -1.1234567891 +signedtest4a -1.9990000000 -1.9990000000 +signedtest4a 1.0000000009 1.0000000009 +signedtest4a -1.0000000009 -1.0000000009 +signedtest4a 0.0000000000 0.0000000000 +signedtest4a NULL NULL +SELECT "signedtest4a", d1, d2 FROM cs3; +signedtest4a d1 d2 +signedtest4a 0.1250000000 0.1250000000 +signedtest4a -0.1250000000 -0.1250000000 +signedtest4a 0.1234500000 0.1234000000 +signedtest4a 0.1999990000 0.1999900000 +signedtest4a -0.1234500000 -0.1234000000 +signedtest4a -0.1999990000 -0.1999900000 +signedtest4a 0.0000090000 0.0000900000 +signedtest4a -0.0000090000 -0.0000900000 +signedtest4a 0.0000000000 0.0000000000 +signedtest4a NULL NULL +CALL signeddeleteproc(); +CALL signedinsertproc(); +DELETE FROM cs1 WHERE d1 < -99998 OR d2 > 998; +DELETE FROM cs2 WHERE d1 < -99999.998 OR d2 > 99999.998; +DELETE FROM cs3 WHERE d1 < -0.99998 OR d2 > 0.998; +SELECT "signedtest4", d1, d2 FROM cs1; +signedtest4 d1 d2 +signedtest4 125 125 +signedtest4 -125 -125 +signedtest4 99998 998 +signedtest4 -99998 -998 +signedtest4 0 0 +signedtest4 NULL NULL +SELECT "signedtest4", d1, d2 FROM cs2; +signedtest4 d1 d2 +signedtest4 1.2500000000 1.2500000000 +signedtest4 -1.2500000000 -1.2500000000 +signedtest4 99999.9980000000 99999.9980000000 +signedtest4 -99999.9980000000 -99999.9980000000 +signedtest4 1.1234567891 1.1234567891 +signedtest4 1.9990000000 1.9990000000 +signedtest4 -1.1234567891 -1.1234567891 +signedtest4 -1.9990000000 -1.9990000000 +signedtest4 1.0000000009 1.0000000009 +signedtest4 -1.0000000009 -1.0000000009 +signedtest4 0.0000000000 0.0000000000 +signedtest4 NULL NULL +SELECT "signedtest4", d1, d2 FROM cs3; +signedtest4 d1 d2 +signedtest4 0.1250000000 0.1250000000 +signedtest4 -0.1250000000 -0.1250000000 +signedtest4 0.9999800000 0.9980000000 +signedtest4 -0.9999800000 -0.9980000000 +signedtest4 0.1234500000 0.1234000000 +signedtest4 0.1999990000 0.1999900000 +signedtest4 -0.1234500000 -0.1234000000 +signedtest4 -0.1999990000 -0.1999900000 +signedtest4 0.0000090000 0.0000900000 +signedtest4 -0.0000090000 -0.0000900000 +signedtest4 0.0000000000 0.0000000000 +signedtest4 NULL NULL +DELETE FROM cs1 WHERE d1 is NULL; +DELETE FROM cs2 WHERE d1 is NULL; +DELETE FROM cs3 WHERE d1 is NULL; +SELECT "signedtest5", d1, d2 FROM cs1; +signedtest5 d1 d2 +signedtest5 125 125 +signedtest5 -125 -125 +signedtest5 99998 998 +signedtest5 -99998 -998 +signedtest5 0 0 +SELECT "signedtest5", d1, d2 FROM cs2; +signedtest5 d1 d2 +signedtest5 1.2500000000 1.2500000000 +signedtest5 -1.2500000000 -1.2500000000 +signedtest5 99999.9980000000 99999.9980000000 +signedtest5 -99999.9980000000 -99999.9980000000 +signedtest5 1.1234567891 1.1234567891 +signedtest5 1.9990000000 1.9990000000 +signedtest5 -1.1234567891 -1.1234567891 +signedtest5 -1.9990000000 -1.9990000000 +signedtest5 1.0000000009 1.0000000009 +signedtest5 -1.0000000009 -1.0000000009 +signedtest5 0.0000000000 0.0000000000 +SELECT "signedtest5", d1, d2 FROM cs3; +signedtest5 d1 d2 +signedtest5 0.1250000000 0.1250000000 +signedtest5 -0.1250000000 -0.1250000000 +signedtest5 0.9999800000 0.9980000000 +signedtest5 -0.9999800000 -0.9980000000 +signedtest5 0.1234500000 0.1234000000 +signedtest5 0.1999990000 0.1999900000 +signedtest5 -0.1234500000 -0.1234000000 +signedtest5 -0.1999990000 -0.1999900000 +signedtest5 0.0000090000 0.0000900000 +signedtest5 -0.0000090000 -0.0000900000 +signedtest5 0.0000000000 0.0000000000 +DELETE FROM cs1 WHERE d1 != 125; +DELETE FROM cs2 WHERE d1 != 1.25; +DELETE FROM cs3 WHERE d1 != 0.125; +SELECT "signedtest6", d1, d2 FROM cs1; +signedtest6 d1 d2 +signedtest6 125 125 +SELECT "signedtest6", d1, d2 FROM cs2; +signedtest6 d1 d2 +signedtest6 1.2500000000 1.2500000000 +SELECT "signedtest6", d1, d2 FROM cs3; +signedtest6 d1 d2 +signedtest6 0.1250000000 0.1250000000 +CALL signeddeleteproc(); +CALL signedinsertproc(); +DELETE FROM cs1 WHERE d1 = d2; +DELETE FROM cs2 WHERE d1 = d2; +DELETE FROM cs3 WHERE d1 = d2; +SELECT "signedtest7", d1, d2 FROM cs1; +signedtest7 d1 d2 +signedtest7 99998 998 +signedtest7 99999 999 +signedtest7 -99998 -998 +signedtest7 -99999 -999 +signedtest7 NULL NULL +SELECT "signedtest7", d1, d2 FROM cs2; +signedtest7 d1 d2 +signedtest7 NULL NULL +SELECT "signedtest7", d1, d2 FROM cs3; +signedtest7 d1 d2 +signedtest7 0.9999800000 0.9980000000 +signedtest7 0.9999900000 0.9990000000 +signedtest7 -0.9999800000 -0.9980000000 +signedtest7 -0.9999900000 -0.9990000000 +signedtest7 0.1234500000 0.1234000000 +signedtest7 0.1999990000 0.1999900000 +signedtest7 -0.1234500000 -0.1234000000 +signedtest7 -0.1999990000 -0.1999900000 +signedtest7 0.0000090000 0.0000900000 +signedtest7 -0.0000090000 -0.0000900000 +signedtest7 NULL NULL +CALL signeddeleteproc(); +CALL signedinsertproc(); +DELETE FROM cs1 WHERE d1 != d2; +DELETE FROM cs2 WHERE d1 != d2; +DELETE FROM cs3 WHERE d1 != d2; +SELECT "signedtest8", d1, d2 FROM cs1; +signedtest8 d1 d2 +signedtest8 125 125 +signedtest8 -125 -125 +signedtest8 0 0 +signedtest8 NULL NULL +SELECT "signedtest8", d1, d2 FROM cs2; +signedtest8 d1 d2 +signedtest8 1.2500000000 1.2500000000 +signedtest8 -1.2500000000 -1.2500000000 +signedtest8 99999.9980000000 99999.9980000000 +signedtest8 99999.9990000000 99999.9990000000 +signedtest8 -99999.9980000000 -99999.9980000000 +signedtest8 -99999.9990000000 -99999.9990000000 +signedtest8 1.1234567891 1.1234567891 +signedtest8 1.9990000000 1.9990000000 +signedtest8 -1.1234567891 -1.1234567891 +signedtest8 -1.9990000000 -1.9990000000 +signedtest8 1.0000000009 1.0000000009 +signedtest8 -1.0000000009 -1.0000000009 +signedtest8 0.0000000000 0.0000000000 +signedtest8 NULL NULL +SELECT "signedtest8", d1, d2 FROM cs3; +signedtest8 d1 d2 +signedtest8 0.1250000000 0.1250000000 +signedtest8 -0.1250000000 -0.1250000000 +signedtest8 0.0000000000 0.0000000000 +signedtest8 NULL NULL +CALL signeddeleteproc(); +CALL signedinsertproc(); +DELETE FROM cs1 WHERE d1 < d2; +DELETE FROM cs2 WHERE d1 < d2; +DELETE FROM cs3 WHERE d1 < d2; +SELECT "signedtest9", d1, d2 FROM cs1; +signedtest9 d1 d2 +signedtest9 125 125 +signedtest9 -125 -125 +signedtest9 99998 998 +signedtest9 99999 999 +signedtest9 0 0 +signedtest9 NULL NULL +SELECT "signedtest9", d1, d2 FROM cs2; +signedtest9 d1 d2 +signedtest9 1.2500000000 1.2500000000 +signedtest9 -1.2500000000 -1.2500000000 +signedtest9 99999.9980000000 99999.9980000000 +signedtest9 99999.9990000000 99999.9990000000 +signedtest9 -99999.9980000000 -99999.9980000000 +signedtest9 -99999.9990000000 -99999.9990000000 +signedtest9 1.1234567891 1.1234567891 +signedtest9 1.9990000000 1.9990000000 +signedtest9 -1.1234567891 -1.1234567891 +signedtest9 -1.9990000000 -1.9990000000 +signedtest9 1.0000000009 1.0000000009 +signedtest9 -1.0000000009 -1.0000000009 +signedtest9 0.0000000000 0.0000000000 +signedtest9 NULL NULL +SELECT "signedtest9", d1, d2 FROM cs3; +signedtest9 d1 d2 +signedtest9 0.1250000000 0.1250000000 +signedtest9 -0.1250000000 -0.1250000000 +signedtest9 0.9999800000 0.9980000000 +signedtest9 0.9999900000 0.9990000000 +signedtest9 0.1234500000 0.1234000000 +signedtest9 0.1999990000 0.1999900000 +signedtest9 -0.0000090000 -0.0000900000 +signedtest9 0.0000000000 0.0000000000 +signedtest9 NULL NULL +CALL signeddeleteproc(); +CALL signedinsertproc(); +DELETE FROM cs1 WHERE d1 > d2; +DELETE FROM cs2 WHERE d1 > d2; +DELETE FROM cs3 WHERE d1 > d2; +SELECT "signedtest10", d1, d2 FROM cs1; +signedtest10 d1 d2 +signedtest10 125 125 +signedtest10 -125 -125 +signedtest10 -99998 -998 +signedtest10 -99999 -999 +signedtest10 0 0 +signedtest10 NULL NULL +SELECT "signedtest10", d1, d2 FROM cs2; +signedtest10 d1 d2 +signedtest10 1.2500000000 1.2500000000 +signedtest10 -1.2500000000 -1.2500000000 +signedtest10 99999.9980000000 99999.9980000000 +signedtest10 99999.9990000000 99999.9990000000 +signedtest10 -99999.9980000000 -99999.9980000000 +signedtest10 -99999.9990000000 -99999.9990000000 +signedtest10 1.1234567891 1.1234567891 +signedtest10 1.9990000000 1.9990000000 +signedtest10 -1.1234567891 -1.1234567891 +signedtest10 -1.9990000000 -1.9990000000 +signedtest10 1.0000000009 1.0000000009 +signedtest10 -1.0000000009 -1.0000000009 +signedtest10 0.0000000000 0.0000000000 +signedtest10 NULL NULL +SELECT "signedtest10", d1, d2 FROM cs3; +signedtest10 d1 d2 +signedtest10 0.1250000000 0.1250000000 +signedtest10 -0.1250000000 -0.1250000000 +signedtest10 -0.9999800000 -0.9980000000 +signedtest10 -0.9999900000 -0.9990000000 +signedtest10 -0.1234500000 -0.1234000000 +signedtest10 -0.1999990000 -0.1999900000 +signedtest10 0.0000090000 0.0000900000 +signedtest10 0.0000000000 0.0000000000 +signedtest10 NULL NULL +DROP PROCEDURE IF EXISTS signedinsertproc; +DROP PROCEDURE IF EXISTS signeddeleteproc; +DROP DATABASE delete_signed_test; diff --git a/mysql-test/suite/tianmu/r/update_signed.result b/mysql-test/suite/tianmu/r/update_signed.result new file mode 100644 index 0000000000..cddcf57281 --- /dev/null +++ b/mysql-test/suite/tianmu/r/update_signed.result @@ -0,0 +1,540 @@ +# +# UPDATE decimal and DElETE WHERE +# +DROP DATABASE IF EXISTS update_signed_test; +CREATE DATABASE update_signed_test; +USE update_signed_test; +DROP PROCEDURE IF EXISTS signedinsertproc; +DROP PROCEDURE IF EXISTS signeddeleteproc; +CREATE PROCEDURE signedinsertproc () +BEGIN +INSERT INTO cs1 VALUES (125, 125); +INSERT INTO cs1 VALUES (-125, -125); +INSERT INTO cs1 values (99998, 9998); +INSERT INTO cs1 values (99999, 9999); +INSERT INTO cs1 values (-99998, -9998); +INSERT INTO cs1 values (-99999, -9999); +INSERT INTO cs1 VALUES (0, 0); +INSERT INTO cs1 VALUES (NULL, NULL); +INSERT INTO cs2 VALUES (1.25, 1.25); +INSERT INTO cs2 VALUES (-1.25, -1.25); +INSERT INTO cs2 values (99999.99998, 99999.99998); +INSERT INTO cs2 values (99999.99999, 99999.99999); +INSERT INTO cs2 values (-99999.99998, -99999.99998); +INSERT INTO cs2 values (-99999.99999, -99999.99999); +INSERT INTO cs2 VALUES (1.1234567891, 1.1234567891); +INSERT INTO cs2 VALUES (1.99999, 1.99999); +INSERT INTO cs2 VALUES (-1.1234567891, -1.1234567891); +INSERT INTO cs2 VALUES (-1.99999, -1.99999); +INSERT INTO cs2 VALUES (1.0000000009, 1.0000000009); +INSERT INTO cs2 VALUES (-1.0000000009, -1.0000000009); +INSERT INTO cs2 VALUES (0, 0); +INSERT INTO cs2 VALUES (NULL, NULL); +INSERT INTO cs3 VALUES (0.125, 0.125); +INSERT INTO cs3 VALUES (-0.125, -0.125); +INSERT INTO cs3 values (0.99998, 0.9998); +INSERT INTO cs3 values (0.99999, 0.9999); +INSERT INTO cs3 values (-0.99998, -0.9998); +INSERT INTO cs3 values (-0.99999, -0.9999); +INSERT INTO cs3 VALUES (0.12345, 0.1234); +INSERT INTO cs3 VALUES (0.19999, 0.1999); +INSERT INTO cs3 VALUES (-0.12345, -0.1234); +INSERT INTO cs3 VALUES (-0.19999, -0.1999); +INSERT INTO cs3 VALUES (0.00009, 0.0009); +INSERT INTO cs3 VALUES (-0.00009, -0.0009); +INSERT INTO cs3 VALUES (0, 0); +INSERT INTO cs3 VALUES (NULL, NULL); +END// +CREATE PROCEDURE signeddeleteproc () +BEGIN +DELETE FROM cs1; +DELETE FROM cs2; +DELETE FROM cs3; +END// +DROP TABLE IF EXISTS cs1; +Warnings: +Note 1051 Unknown table 'update_signed_test.cs1' +DROP TABLE IF EXISTS cs2; +Warnings: +Note 1051 Unknown table 'update_signed_test.cs2' +DROP TABLE IF EXISTS cs3; +Warnings: +Note 1051 Unknown table 'update_signed_test.cs3' +CREATE TABLE cs1 (d1 DECIMAL(18), d2 DECIMAL(18)); +CREATE TABLE cs2 (d1 DECIMAL(18,10), d2 DECIMAL(18,10)); +CREATE TABLE cs3 (d1 DECIMAL(18,10), d2 DECIMAL(18,10)); +CALL signedinsertproc(); +UPDATE cs1 SET d1=12345, d2=1234; +UPDATE cs2 SET d1=123456.90123, d2=12345.01234; +UPDATE cs3 SET d1=0.12345, d2=0.1234; +SELECT "signedtest1", d1, d2 FROM cs1; +signedtest1 d1 d2 +signedtest1 12345 1234 +signedtest1 12345 1234 +signedtest1 12345 1234 +signedtest1 12345 1234 +signedtest1 12345 1234 +signedtest1 12345 1234 +signedtest1 12345 1234 +signedtest1 12345 1234 +SELECT "signedtest1", d1, d2 FROM cs2; +signedtest1 d1 d2 +signedtest1 123456.9012300000 12345.0123400000 +signedtest1 123456.9012300000 12345.0123400000 +signedtest1 123456.9012300000 12345.0123400000 +signedtest1 123456.9012300000 12345.0123400000 +signedtest1 123456.9012300000 12345.0123400000 +signedtest1 123456.9012300000 12345.0123400000 +signedtest1 123456.9012300000 12345.0123400000 +signedtest1 123456.9012300000 12345.0123400000 +signedtest1 123456.9012300000 12345.0123400000 +signedtest1 123456.9012300000 12345.0123400000 +signedtest1 123456.9012300000 12345.0123400000 +signedtest1 123456.9012300000 12345.0123400000 +signedtest1 123456.9012300000 12345.0123400000 +signedtest1 123456.9012300000 12345.0123400000 +SELECT "signedtest1", d1, d2 FROM cs3; +signedtest1 d1 d2 +signedtest1 0.1234500000 0.1234000000 +signedtest1 0.1234500000 0.1234000000 +signedtest1 0.1234500000 0.1234000000 +signedtest1 0.1234500000 0.1234000000 +signedtest1 0.1234500000 0.1234000000 +signedtest1 0.1234500000 0.1234000000 +signedtest1 0.1234500000 0.1234000000 +signedtest1 0.1234500000 0.1234000000 +signedtest1 0.1234500000 0.1234000000 +signedtest1 0.1234500000 0.1234000000 +signedtest1 0.1234500000 0.1234000000 +signedtest1 0.1234500000 0.1234000000 +signedtest1 0.1234500000 0.1234000000 +signedtest1 0.1234500000 0.1234000000 +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=12345, d2=0 WHERE d1=-99998; +UPDATE cs1 SET d1=0, d2=12345 WHERE d2=9999; +UPDATE cs2 SET d1=123456.90123, d2=0 WHERE d1=-99999.99998; +UPDATE cs2 SET d1=0, d2=12345.012345678 WHERE d2=99999.99999; +UPDATE cs3 SET d1=0.12345, d2=0 WHERE d1=-0.99998; +UPDATE cs3 SET d1=0, d2=0.12345 WHERE d2=0.9999; +SELECT "signedtest2", d1, d2 FROM cs1; +signedtest2 d1 d2 +signedtest2 125 125 +signedtest2 -125 -125 +signedtest2 99998 9998 +signedtest2 0 12345 +signedtest2 12345 0 +signedtest2 -99999 -9999 +signedtest2 0 0 +signedtest2 NULL NULL +SELECT "signedtest2", d1, d2 FROM cs2; +signedtest2 d1 d2 +signedtest2 1.2500000000 1.2500000000 +signedtest2 -1.2500000000 -1.2500000000 +signedtest2 99999.9999800000 99999.9999800000 +signedtest2 0.0000000000 12345.0123456780 +signedtest2 123456.9012300000 0.0000000000 +signedtest2 -99999.9999900000 -99999.9999900000 +signedtest2 1.1234567891 1.1234567891 +signedtest2 1.9999900000 1.9999900000 +signedtest2 -1.1234567891 -1.1234567891 +signedtest2 -1.9999900000 -1.9999900000 +signedtest2 1.0000000009 1.0000000009 +signedtest2 -1.0000000009 -1.0000000009 +signedtest2 0.0000000000 0.0000000000 +signedtest2 NULL NULL +SELECT "signedtest2", d1, d2 FROM cs3; +signedtest2 d1 d2 +signedtest2 0.1250000000 0.1250000000 +signedtest2 -0.1250000000 -0.1250000000 +signedtest2 0.9999800000 0.9998000000 +signedtest2 0.0000000000 0.1234500000 +signedtest2 0.1234500000 0.0000000000 +signedtest2 -0.9999900000 -0.9999000000 +signedtest2 0.1234500000 0.1234000000 +signedtest2 0.1999900000 0.1999000000 +signedtest2 -0.1234500000 -0.1234000000 +signedtest2 -0.1999900000 -0.1999000000 +signedtest2 0.0000900000 0.0009000000 +signedtest2 -0.0000900000 -0.0009000000 +signedtest2 0.0000000000 0.0000000000 +signedtest2 NULL NULL +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=12345, d2=1234 WHERE d1 < -99998 OR d2 > 9998; +UPDATE cs2 SET d1=123456.90123, d2=12345.01234 WHERE d1 < -99999.99998 OR d2 > 99999.99998; +UPDATE cs3 SET d1=0.12345, d2=0.1234 WHERE d1 < -0.99998 OR d2 > 0.9998; +SELECT "signedtest4a", d1, d2 FROM cs1; +signedtest4a d1 d2 +signedtest4a 125 125 +signedtest4a -125 -125 +signedtest4a 99998 9998 +signedtest4a 12345 1234 +signedtest4a -99998 -9998 +signedtest4a 12345 1234 +signedtest4a 0 0 +signedtest4a NULL NULL +SELECT "signedtest4a", d1, d2 FROM cs2; +signedtest4a d1 d2 +signedtest4a 1.2500000000 1.2500000000 +signedtest4a -1.2500000000 -1.2500000000 +signedtest4a 99999.9999800000 99999.9999800000 +signedtest4a 123456.9012300000 12345.0123400000 +signedtest4a -99999.9999800000 -99999.9999800000 +signedtest4a 123456.9012300000 12345.0123400000 +signedtest4a 1.1234567891 1.1234567891 +signedtest4a 1.9999900000 1.9999900000 +signedtest4a -1.1234567891 -1.1234567891 +signedtest4a -1.9999900000 -1.9999900000 +signedtest4a 1.0000000009 1.0000000009 +signedtest4a -1.0000000009 -1.0000000009 +signedtest4a 0.0000000000 0.0000000000 +signedtest4a NULL NULL +SELECT "signedtest4a", d1, d2 FROM cs3; +signedtest4a d1 d2 +signedtest4a 0.1250000000 0.1250000000 +signedtest4a -0.1250000000 -0.1250000000 +signedtest4a 0.9999800000 0.9998000000 +signedtest4a 0.1234500000 0.1234000000 +signedtest4a -0.9999800000 -0.9998000000 +signedtest4a 0.1234500000 0.1234000000 +signedtest4a 0.1234500000 0.1234000000 +signedtest4a 0.1999900000 0.1999000000 +signedtest4a -0.1234500000 -0.1234000000 +signedtest4a -0.1999900000 -0.1999000000 +signedtest4a 0.0000900000 0.0009000000 +signedtest4a -0.0000900000 -0.0009000000 +signedtest4a 0.0000000000 0.0000000000 +signedtest4a NULL NULL +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=12345, d2=1234 WHERE d1 <= -99998 OR d2 >= 9998; +UPDATE cs2 SET d1=123456.90123, d2=12345.01234 WHERE d1 <= -99999.99998 OR d2 >= 99999.99998; +UPDATE cs3 SET d1=0.12345, d2=0.1234 WHERE d1 <= -0.99998 OR d2 >= 0.9998; +SELECT "signedtest4b", d1, d2 FROM cs1; +signedtest4b d1 d2 +signedtest4b 125 125 +signedtest4b -125 -125 +signedtest4b 12345 1234 +signedtest4b 12345 1234 +signedtest4b 12345 1234 +signedtest4b 12345 1234 +signedtest4b 0 0 +signedtest4b NULL NULL +SELECT "signedtest4b", d1, d2 FROM cs2; +signedtest4b d1 d2 +signedtest4b 1.2500000000 1.2500000000 +signedtest4b -1.2500000000 -1.2500000000 +signedtest4b 123456.9012300000 12345.0123400000 +signedtest4b 123456.9012300000 12345.0123400000 +signedtest4b 123456.9012300000 12345.0123400000 +signedtest4b 123456.9012300000 12345.0123400000 +signedtest4b 1.1234567891 1.1234567891 +signedtest4b 1.9999900000 1.9999900000 +signedtest4b -1.1234567891 -1.1234567891 +signedtest4b -1.9999900000 -1.9999900000 +signedtest4b 1.0000000009 1.0000000009 +signedtest4b -1.0000000009 -1.0000000009 +signedtest4b 0.0000000000 0.0000000000 +signedtest4b NULL NULL +SELECT "signedtest4b", d1, d2 FROM cs3; +signedtest4b d1 d2 +signedtest4b 0.1250000000 0.1250000000 +signedtest4b -0.1250000000 -0.1250000000 +signedtest4b 0.1234500000 0.1234000000 +signedtest4b 0.1234500000 0.1234000000 +signedtest4b 0.1234500000 0.1234000000 +signedtest4b 0.1234500000 0.1234000000 +signedtest4b 0.1234500000 0.1234000000 +signedtest4b 0.1999900000 0.1999000000 +signedtest4b -0.1234500000 -0.1234000000 +signedtest4b -0.1999900000 -0.1999000000 +signedtest4b 0.0000900000 0.0009000000 +signedtest4b -0.0000900000 -0.0009000000 +signedtest4b 0.0000000000 0.0000000000 +signedtest4b NULL NULL +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=12345, d2=1234 WHERE d1 is NULL; +UPDATE cs2 SET d1=123456.90123, d2=12345.01234 WHERE d1 is NULL; +UPDATE cs3 SET d1=0.12345, d2=0.1234 WHERE d1 is NULL; +SELECT "signedtest5", d1, d2 FROM cs1; +signedtest5 d1 d2 +signedtest5 125 125 +signedtest5 -125 -125 +signedtest5 99998 9998 +signedtest5 99999 9999 +signedtest5 -99998 -9998 +signedtest5 -99999 -9999 +signedtest5 0 0 +signedtest5 12345 1234 +SELECT "signedtest5", d1, d2 FROM cs2; +signedtest5 d1 d2 +signedtest5 1.2500000000 1.2500000000 +signedtest5 -1.2500000000 -1.2500000000 +signedtest5 99999.9999800000 99999.9999800000 +signedtest5 99999.9999900000 99999.9999900000 +signedtest5 -99999.9999800000 -99999.9999800000 +signedtest5 -99999.9999900000 -99999.9999900000 +signedtest5 1.1234567891 1.1234567891 +signedtest5 1.9999900000 1.9999900000 +signedtest5 -1.1234567891 -1.1234567891 +signedtest5 -1.9999900000 -1.9999900000 +signedtest5 1.0000000009 1.0000000009 +signedtest5 -1.0000000009 -1.0000000009 +signedtest5 0.0000000000 0.0000000000 +signedtest5 123456.9012300000 12345.0123400000 +SELECT "signedtest5", d1, d2 FROM cs3; +signedtest5 d1 d2 +signedtest5 0.1250000000 0.1250000000 +signedtest5 -0.1250000000 -0.1250000000 +signedtest5 0.9999800000 0.9998000000 +signedtest5 0.9999900000 0.9999000000 +signedtest5 -0.9999800000 -0.9998000000 +signedtest5 -0.9999900000 -0.9999000000 +signedtest5 0.1234500000 0.1234000000 +signedtest5 0.1999900000 0.1999000000 +signedtest5 -0.1234500000 -0.1234000000 +signedtest5 -0.1999900000 -0.1999000000 +signedtest5 0.0000900000 0.0009000000 +signedtest5 -0.0000900000 -0.0009000000 +signedtest5 0.0000000000 0.0000000000 +signedtest5 0.1234500000 0.1234000000 +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=12345, d2=1234 WHERE d1 != 125; +UPDATE cs2 SET d1=123456.90123, d2=12345.01234 WHERE d1 != 1.25; +UPDATE cs3 SET d1=0.12345, d2=0.1234 WHERE d1 != 0.125; +SELECT "signedtest6", d1, d2 FROM cs1; +signedtest6 d1 d2 +signedtest6 125 125 +signedtest6 12345 1234 +signedtest6 12345 1234 +signedtest6 12345 1234 +signedtest6 12345 1234 +signedtest6 12345 1234 +signedtest6 12345 1234 +signedtest6 NULL NULL +SELECT "signedtest6", d1, d2 FROM cs2; +signedtest6 d1 d2 +signedtest6 1.2500000000 1.2500000000 +signedtest6 123456.9012300000 12345.0123400000 +signedtest6 123456.9012300000 12345.0123400000 +signedtest6 123456.9012300000 12345.0123400000 +signedtest6 123456.9012300000 12345.0123400000 +signedtest6 123456.9012300000 12345.0123400000 +signedtest6 123456.9012300000 12345.0123400000 +signedtest6 123456.9012300000 12345.0123400000 +signedtest6 123456.9012300000 12345.0123400000 +signedtest6 123456.9012300000 12345.0123400000 +signedtest6 123456.9012300000 12345.0123400000 +signedtest6 123456.9012300000 12345.0123400000 +signedtest6 123456.9012300000 12345.0123400000 +signedtest6 NULL NULL +SELECT "signedtest6", d1, d2 FROM cs3; +signedtest6 d1 d2 +signedtest6 0.1250000000 0.1250000000 +signedtest6 0.1234500000 0.1234000000 +signedtest6 0.1234500000 0.1234000000 +signedtest6 0.1234500000 0.1234000000 +signedtest6 0.1234500000 0.1234000000 +signedtest6 0.1234500000 0.1234000000 +signedtest6 0.1234500000 0.1234000000 +signedtest6 0.1234500000 0.1234000000 +signedtest6 0.1234500000 0.1234000000 +signedtest6 0.1234500000 0.1234000000 +signedtest6 0.1234500000 0.1234000000 +signedtest6 0.1234500000 0.1234000000 +signedtest6 0.1234500000 0.1234000000 +signedtest6 NULL NULL +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d2=d1 WHERE d1 = d2; +UPDATE cs2 SET d2=d1 WHERE d1 = d2; +UPDATE cs3 SET d2=d1 WHERE d1 = d2; +SELECT "signedtest7", d1, d2 FROM cs1; +signedtest7 d1 d2 +signedtest7 125 125 +signedtest7 -125 -125 +signedtest7 99998 9998 +signedtest7 99999 9999 +signedtest7 -99998 -9998 +signedtest7 -99999 -9999 +signedtest7 0 0 +signedtest7 NULL NULL +SELECT "signedtest7", d1, d2 FROM cs2; +signedtest7 d1 d2 +signedtest7 1.2500000000 1.2500000000 +signedtest7 -1.2500000000 -1.2500000000 +signedtest7 99999.9999800000 99999.9999800000 +signedtest7 99999.9999900000 99999.9999900000 +signedtest7 -99999.9999800000 -99999.9999800000 +signedtest7 -99999.9999900000 -99999.9999900000 +signedtest7 1.1234567891 1.1234567891 +signedtest7 1.9999900000 1.9999900000 +signedtest7 -1.1234567891 -1.1234567891 +signedtest7 -1.9999900000 -1.9999900000 +signedtest7 1.0000000009 1.0000000009 +signedtest7 -1.0000000009 -1.0000000009 +signedtest7 0.0000000000 0.0000000000 +signedtest7 NULL NULL +SELECT "signedtest7", d1, d2 FROM cs3; +signedtest7 d1 d2 +signedtest7 0.1250000000 0.1250000000 +signedtest7 -0.1250000000 -0.1250000000 +signedtest7 0.9999800000 0.9998000000 +signedtest7 0.9999900000 0.9999000000 +signedtest7 -0.9999800000 -0.9998000000 +signedtest7 -0.9999900000 -0.9999000000 +signedtest7 0.1234500000 0.1234000000 +signedtest7 0.1999900000 0.1999000000 +signedtest7 -0.1234500000 -0.1234000000 +signedtest7 -0.1999900000 -0.1999000000 +signedtest7 0.0000900000 0.0009000000 +signedtest7 -0.0000900000 -0.0009000000 +signedtest7 0.0000000000 0.0000000000 +signedtest7 NULL NULL +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=d2 WHERE d1 != d2; +UPDATE cs2 SET d1=d2 WHERE d1 != d2; +UPDATE cs3 SET d1=d2 WHERE d1 != d2; +SELECT "signedtest8", d1, d2 FROM cs1; +signedtest8 d1 d2 +signedtest8 125 125 +signedtest8 -125 -125 +signedtest8 9998 9998 +signedtest8 9999 9999 +signedtest8 -9998 -9998 +signedtest8 -9999 -9999 +signedtest8 0 0 +signedtest8 NULL NULL +SELECT "signedtest8", d1, d2 FROM cs2; +signedtest8 d1 d2 +signedtest8 1.2500000000 1.2500000000 +signedtest8 -1.2500000000 -1.2500000000 +signedtest8 99999.9999800000 99999.9999800000 +signedtest8 99999.9999900000 99999.9999900000 +signedtest8 -99999.9999800000 -99999.9999800000 +signedtest8 -99999.9999900000 -99999.9999900000 +signedtest8 1.1234567891 1.1234567891 +signedtest8 1.9999900000 1.9999900000 +signedtest8 -1.1234567891 -1.1234567891 +signedtest8 -1.9999900000 -1.9999900000 +signedtest8 1.0000000009 1.0000000009 +signedtest8 -1.0000000009 -1.0000000009 +signedtest8 0.0000000000 0.0000000000 +signedtest8 NULL NULL +SELECT "signedtest8", d1, d2 FROM cs3; +signedtest8 d1 d2 +signedtest8 0.1250000000 0.1250000000 +signedtest8 -0.1250000000 -0.1250000000 +signedtest8 0.9998000000 0.9998000000 +signedtest8 0.9999000000 0.9999000000 +signedtest8 -0.9998000000 -0.9998000000 +signedtest8 -0.9999000000 -0.9999000000 +signedtest8 0.1234000000 0.1234000000 +signedtest8 0.1999000000 0.1999000000 +signedtest8 -0.1234000000 -0.1234000000 +signedtest8 -0.1999000000 -0.1999000000 +signedtest8 0.0009000000 0.0009000000 +signedtest8 -0.0009000000 -0.0009000000 +signedtest8 0.0000000000 0.0000000000 +signedtest8 NULL NULL +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=12345, d2=1234 WHERE d1 < d2; +UPDATE cs2 SET d1=123456.90123, d2=12345.01234 WHERE d1 < d2; +UPDATE cs3 SET d1=0.12345, d2=0.1234 WHERE d1 < d2; +SELECT "signedtest9", d1, d2 FROM cs1; +signedtest9 d1 d2 +signedtest9 125 125 +signedtest9 -125 -125 +signedtest9 99998 9998 +signedtest9 99999 9999 +signedtest9 12345 1234 +signedtest9 12345 1234 +signedtest9 0 0 +signedtest9 NULL NULL +SELECT "signedtest9", d1, d2 FROM cs2; +signedtest9 d1 d2 +signedtest9 1.2500000000 1.2500000000 +signedtest9 -1.2500000000 -1.2500000000 +signedtest9 99999.9999800000 99999.9999800000 +signedtest9 99999.9999900000 99999.9999900000 +signedtest9 -99999.9999800000 -99999.9999800000 +signedtest9 -99999.9999900000 -99999.9999900000 +signedtest9 1.1234567891 1.1234567891 +signedtest9 1.9999900000 1.9999900000 +signedtest9 -1.1234567891 -1.1234567891 +signedtest9 -1.9999900000 -1.9999900000 +signedtest9 1.0000000009 1.0000000009 +signedtest9 -1.0000000009 -1.0000000009 +signedtest9 0.0000000000 0.0000000000 +signedtest9 NULL NULL +SELECT "signedtest9", d1, d2 FROM cs3; +signedtest9 d1 d2 +signedtest9 0.1250000000 0.1250000000 +signedtest9 -0.1250000000 -0.1250000000 +signedtest9 0.9999800000 0.9998000000 +signedtest9 0.9999900000 0.9999000000 +signedtest9 0.1234500000 0.1234000000 +signedtest9 0.1234500000 0.1234000000 +signedtest9 0.1234500000 0.1234000000 +signedtest9 0.1999900000 0.1999000000 +signedtest9 0.1234500000 0.1234000000 +signedtest9 0.1234500000 0.1234000000 +signedtest9 0.1234500000 0.1234000000 +signedtest9 -0.0000900000 -0.0009000000 +signedtest9 0.0000000000 0.0000000000 +signedtest9 NULL NULL +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=d2 WHERE d1 > d2; +UPDATE cs2 SET d1=d2 WHERE d1 > d2; +UPDATE cs3 SET d1=d2 WHERE d1 > d2; +SELECT "signedtest10", d1, d2 FROM cs1; +signedtest10 d1 d2 +signedtest10 125 125 +signedtest10 -125 -125 +signedtest10 9998 9998 +signedtest10 9999 9999 +signedtest10 -99998 -9998 +signedtest10 -99999 -9999 +signedtest10 0 0 +signedtest10 NULL NULL +SELECT "signedtest10", d1, d2 FROM cs2; +signedtest10 d1 d2 +signedtest10 1.2500000000 1.2500000000 +signedtest10 -1.2500000000 -1.2500000000 +signedtest10 99999.9999800000 99999.9999800000 +signedtest10 99999.9999900000 99999.9999900000 +signedtest10 -99999.9999800000 -99999.9999800000 +signedtest10 -99999.9999900000 -99999.9999900000 +signedtest10 1.1234567891 1.1234567891 +signedtest10 1.9999900000 1.9999900000 +signedtest10 -1.1234567891 -1.1234567891 +signedtest10 -1.9999900000 -1.9999900000 +signedtest10 1.0000000009 1.0000000009 +signedtest10 -1.0000000009 -1.0000000009 +signedtest10 0.0000000000 0.0000000000 +signedtest10 NULL NULL +SELECT "signedtest10", d1, d2 FROM cs3; +signedtest10 d1 d2 +signedtest10 0.1250000000 0.1250000000 +signedtest10 -0.1250000000 -0.1250000000 +signedtest10 0.9998000000 0.9998000000 +signedtest10 0.9999000000 0.9999000000 +signedtest10 -0.9999800000 -0.9998000000 +signedtest10 -0.9999900000 -0.9999000000 +signedtest10 0.1234000000 0.1234000000 +signedtest10 0.1999000000 0.1999000000 +signedtest10 -0.1234500000 -0.1234000000 +signedtest10 -0.1999900000 -0.1999000000 +signedtest10 0.0000900000 0.0009000000 +signedtest10 -0.0009000000 -0.0009000000 +signedtest10 0.0000000000 0.0000000000 +signedtest10 NULL NULL +DROP PROCEDURE IF EXISTS signedinsertproc; +DROP PROCEDURE IF EXISTS signeddeleteproc; +DROP DATABASE update_signed_test; diff --git a/mysql-test/suite/tianmu/t/delete_signed.test b/mysql-test/suite/tianmu/t/delete_signed.test new file mode 100644 index 0000000000..3074a11cfd --- /dev/null +++ b/mysql-test/suite/tianmu/t/delete_signed.test @@ -0,0 +1,201 @@ +--source include/have_tianmu.inc + +--echo # +--echo # DELETE decimal and DElETE WHERE +--echo # + +--disable_warnings +DROP DATABASE IF EXISTS delete_signed_test; + +CREATE DATABASE delete_signed_test; +USE delete_signed_test; + +DROP PROCEDURE IF EXISTS signedinsertproc; +DROP PROCEDURE IF EXISTS signeddeleteproc; +--enable_warnings + +DELIMITER //; + +CREATE PROCEDURE signedinsertproc () + BEGIN + INSERT INTO cs1 VALUES (125, 125); + INSERT INTO cs1 VALUES (-125, -125); + INSERT INTO cs1 values (99998, 998); + INSERT INTO cs1 values (99999, 999); + INSERT INTO cs1 values (-99998, -998); + INSERT INTO cs1 values (-99999, -999); + INSERT INTO cs1 VALUES (0, 0); + INSERT INTO cs1 VALUES (NULL, NULL); + + INSERT INTO cs2 VALUES (1.25, 1.25); + INSERT INTO cs2 VALUES (-1.25, -1.25); + INSERT INTO cs2 values (99999.998, 99999.998); + INSERT INTO cs2 values (99999.999, 99999.999); + INSERT INTO cs2 values (-99999.998, -99999.998); + INSERT INTO cs2 values (-99999.999, -99999.999); + INSERT INTO cs2 VALUES (1.1234567891, 1.1234567891); + INSERT INTO cs2 VALUES (1.999, 1.999); + INSERT INTO cs2 VALUES (-1.1234567891, -1.1234567891); + INSERT INTO cs2 VALUES (-1.999, -1.999); + INSERT INTO cs2 VALUES (1.0000000009, 1.0000000009); + INSERT INTO cs2 VALUES (-1.0000000009, -1.0000000009); + INSERT INTO cs2 VALUES (0, 0); + INSERT INTO cs2 VALUES (NULL, NULL); + + INSERT INTO cs3 VALUES (0.125, 0.125); + INSERT INTO cs3 VALUES (-0.125, -0.125); + INSERT INTO cs3 values (0.99998, 0.998); + INSERT INTO cs3 values (0.99999, 0.999); + INSERT INTO cs3 values (-0.99998, -0.998); + INSERT INTO cs3 values (-0.99999, -0.999); + INSERT INTO cs3 VALUES (0.12345, 0.1234); + INSERT INTO cs3 VALUES (0.199999, 0.19999); + INSERT INTO cs3 VALUES (-0.12345, -0.1234); + INSERT INTO cs3 VALUES (-0.199999, -0.19999); + INSERT INTO cs3 VALUES (0.000009, 0.00009); + INSERT INTO cs3 VALUES (-0.000009, -0.00009); + INSERT INTO cs3 VALUES (0, 0); + INSERT INTO cs3 VALUES (NULL, NULL); + END// + + +CREATE PROCEDURE signeddeleteproc () + BEGIN + DELETE FROM cs1; + DELETE FROM cs2; + DELETE FROM cs3; + END// + + +DELIMITER ;// + +--disable_warnings +DROP TABLE IF EXISTS cs1; +DROP TABLE IF EXISTS cs2; +DROP TABLE IF EXISTS cs3; +# DROP TABLE IF EXISTS cs4; +# DROP TABLE IF EXISTS cs5; +# DROP TABLE IF EXISTS cs6; +--enable_warnings + +CREATE TABLE cs1 (d1 DECIMAL(18), d2 DECIMAL(18)) ; +CREATE TABLE cs2 (d1 DECIMAL(18,10), d2 DECIMAL(18,10)) ; +CREATE TABLE cs3 (d1 DECIMAL(18,10), d2 DECIMAL(18,10)) ; +# CREATE TABLE cs4 (d1 DECIMAL(38) UNSIGNED, d2 DECIMAL(19) UNSIGNED) ; +# CREATE TABLE cs5 (d1 DECIMAL(38,10) UNSIGNED, d2 DECIMAL(19,10) UNSIGNED) ; +# CREATE TABLE cs6 (d1 DECIMAL(38,38) UNSIGNED, d2 DECIMAL(19,19) UNSIGNED) ; + +CALL signedinsertproc(); + +# Full table delete +DELETE FROM cs1; +DELETE FROM cs2; +DELETE FROM cs3; +SELECT "signedtest1", d1, d2 FROM cs1; +SELECT "signedtest1", d1, d2 FROM cs2; +SELECT "signedtest1", d1, d2 FROM cs3; + +# Deletes with WHERE clause +# Delete a single row with a constant value in WHERE clause +CALL signedinsertproc(); +DELETE FROM cs1 WHERE d1=-99998; +DELETE FROM cs1 WHERE d2=999; +DELETE FROM cs2 WHERE d1=-99999.998; +DELETE FROM cs2 WHERE d2=99999.999; +DELETE FROM cs3 WHERE d1=-0.99998; +DELETE FROM cs3 WHERE d2=0.999; +SELECT "signedtest2", d1, d2 FROM cs1; +SELECT "signedtest2", d1, d2 FROM cs2; +SELECT "signedtest2", d1, d2 FROM cs3; + +# BUG #781 is similar to this question +# Delete multiple rows +# Deletes with multiple constant values in WHERE clause +# CALL signeddeleteproc(); +# CALL signedinsertproc(); +# DELETE FROM cs1 WHERE d1 in (-99998, 99999); +# DELETE FROM cs2 WHERE d1 in (-99999.998, 99999.999); +# DELETE FROM cs3 WHERE d1 in (-0.99998, 0.99999); +# SELECT "signedtest3", d1, d2 FROM cs1; +# SELECT "signedtest3", d1, d2 FROM cs2; +# SELECT "signedtest3", d1, d2 FROM cs3; + + +# Deletes with comparison operators in WHERE clause +CALL signeddeleteproc(); +CALL signedinsertproc(); +DELETE FROM cs1 WHERE d1 <= -99998 OR d2 >= 998; +DELETE FROM cs2 WHERE d1 <= -99999.998 OR d2 >= 99999.998; +DELETE FROM cs3 WHERE d1 <= -0.99998 OR d2 >= 0.998; +SELECT "signedtest4a", d1, d2 FROM cs1; +SELECT "signedtest4a", d1, d2 FROM cs2; +SELECT "signedtest4a", d1, d2 FROM cs3; +CALL signeddeleteproc(); +CALL signedinsertproc(); +DELETE FROM cs1 WHERE d1 < -99998 OR d2 > 998; +DELETE FROM cs2 WHERE d1 < -99999.998 OR d2 > 99999.998; +DELETE FROM cs3 WHERE d1 < -0.99998 OR d2 > 0.998; +SELECT "signedtest4", d1, d2 FROM cs1; +SELECT "signedtest4", d1, d2 FROM cs2; +SELECT "signedtest4", d1, d2 FROM cs3; + +# Delete with NULL in the WHERE clause +DELETE FROM cs1 WHERE d1 is NULL; +DELETE FROM cs2 WHERE d1 is NULL; +DELETE FROM cs3 WHERE d1 is NULL; +SELECT "signedtest5", d1, d2 FROM cs1; +SELECT "signedtest5", d1, d2 FROM cs2; +SELECT "signedtest5", d1, d2 FROM cs3; + +# Delete with != operator +DELETE FROM cs1 WHERE d1 != 125; +DELETE FROM cs2 WHERE d1 != 1.25; +DELETE FROM cs3 WHERE d1 != 0.125; +SELECT "signedtest6", d1, d2 FROM cs1; +SELECT "signedtest6", d1, d2 FROM cs2; +SELECT "signedtest6", d1, d2 FROM cs3; + +# Delete with non-constant value in the WHERE clause +CALL signeddeleteproc(); +CALL signedinsertproc(); +DELETE FROM cs1 WHERE d1 = d2; +DELETE FROM cs2 WHERE d1 = d2; +DELETE FROM cs3 WHERE d1 = d2; +SELECT "signedtest7", d1, d2 FROM cs1; +SELECT "signedtest7", d1, d2 FROM cs2; +SELECT "signedtest7", d1, d2 FROM cs3; +CALL signeddeleteproc(); +CALL signedinsertproc(); +DELETE FROM cs1 WHERE d1 != d2; +DELETE FROM cs2 WHERE d1 != d2; +DELETE FROM cs3 WHERE d1 != d2; +SELECT "signedtest8", d1, d2 FROM cs1; +SELECT "signedtest8", d1, d2 FROM cs2; +SELECT "signedtest8", d1, d2 FROM cs3; +CALL signeddeleteproc(); +CALL signedinsertproc(); +DELETE FROM cs1 WHERE d1 < d2; +DELETE FROM cs2 WHERE d1 < d2; +DELETE FROM cs3 WHERE d1 < d2; +SELECT "signedtest9", d1, d2 FROM cs1; +SELECT "signedtest9", d1, d2 FROM cs2; +SELECT "signedtest9", d1, d2 FROM cs3; +CALL signeddeleteproc(); +CALL signedinsertproc(); +DELETE FROM cs1 WHERE d1 > d2; +DELETE FROM cs2 WHERE d1 > d2; +DELETE FROM cs3 WHERE d1 > d2; +SELECT "signedtest10", d1, d2 FROM cs1; +SELECT "signedtest10", d1, d2 FROM cs2; +SELECT "signedtest10", d1, d2 FROM cs3; + +# Deletes with functions and expressions in the WHERE clause + +# Repeat above tests for the unsigned case + +# Deletes with functions and expressions in the WHERE clause + +# Clean UP +DROP PROCEDURE IF EXISTS signedinsertproc; +DROP PROCEDURE IF EXISTS signeddeleteproc; +DROP DATABASE delete_signed_test; diff --git a/mysql-test/suite/tianmu/t/update_signed.test b/mysql-test/suite/tianmu/t/update_signed.test new file mode 100644 index 0000000000..101e6fdb0f --- /dev/null +++ b/mysql-test/suite/tianmu/t/update_signed.test @@ -0,0 +1,200 @@ +--source include/have_tianmu.inc + +--echo # +--echo # UPDATE decimal and DElETE WHERE +--echo # + +--disable_warnings +DROP DATABASE IF EXISTS update_signed_test; + +CREATE DATABASE update_signed_test; +USE update_signed_test; + +DROP PROCEDURE IF EXISTS signedinsertproc; +DROP PROCEDURE IF EXISTS signeddeleteproc; +# DROP PROCEDURE IF EXISTS unsignedinsertproc; +# DROP PROCEDURE IF EXISTS unsigneddeleteproc; +--enable_warnings + +DELIMITER //; + +CREATE PROCEDURE signedinsertproc () + BEGIN + INSERT INTO cs1 VALUES (125, 125); + INSERT INTO cs1 VALUES (-125, -125); + INSERT INTO cs1 values (99998, 9998); + INSERT INTO cs1 values (99999, 9999); + INSERT INTO cs1 values (-99998, -9998); + INSERT INTO cs1 values (-99999, -9999); + INSERT INTO cs1 VALUES (0, 0); + INSERT INTO cs1 VALUES (NULL, NULL); + + INSERT INTO cs2 VALUES (1.25, 1.25); + INSERT INTO cs2 VALUES (-1.25, -1.25); + INSERT INTO cs2 values (99999.99998, 99999.99998); + INSERT INTO cs2 values (99999.99999, 99999.99999); + INSERT INTO cs2 values (-99999.99998, -99999.99998); + INSERT INTO cs2 values (-99999.99999, -99999.99999); + INSERT INTO cs2 VALUES (1.1234567891, 1.1234567891); + INSERT INTO cs2 VALUES (1.99999, 1.99999); + INSERT INTO cs2 VALUES (-1.1234567891, -1.1234567891); + INSERT INTO cs2 VALUES (-1.99999, -1.99999); + INSERT INTO cs2 VALUES (1.0000000009, 1.0000000009); + INSERT INTO cs2 VALUES (-1.0000000009, -1.0000000009); + INSERT INTO cs2 VALUES (0, 0); + INSERT INTO cs2 VALUES (NULL, NULL); + + INSERT INTO cs3 VALUES (0.125, 0.125); + INSERT INTO cs3 VALUES (-0.125, -0.125); + INSERT INTO cs3 values (0.99998, 0.9998); + INSERT INTO cs3 values (0.99999, 0.9999); + INSERT INTO cs3 values (-0.99998, -0.9998); + INSERT INTO cs3 values (-0.99999, -0.9999); + INSERT INTO cs3 VALUES (0.12345, 0.1234); + INSERT INTO cs3 VALUES (0.19999, 0.1999); + INSERT INTO cs3 VALUES (-0.12345, -0.1234); + INSERT INTO cs3 VALUES (-0.19999, -0.1999); + INSERT INTO cs3 VALUES (0.00009, 0.0009); + INSERT INTO cs3 VALUES (-0.00009, -0.0009); + INSERT INTO cs3 VALUES (0, 0); + INSERT INTO cs3 VALUES (NULL, NULL); + END// + + +CREATE PROCEDURE signeddeleteproc () + BEGIN + DELETE FROM cs1; + DELETE FROM cs2; + DELETE FROM cs3; + END// + + +DELIMITER ;// + +DROP TABLE IF EXISTS cs1; +DROP TABLE IF EXISTS cs2; +DROP TABLE IF EXISTS cs3; +# DROP TABLE IF EXISTS cs4; +# DROP TABLE IF EXISTS cs5; +# DROP TABLE IF EXISTS cs6; + +CREATE TABLE cs1 (d1 DECIMAL(18), d2 DECIMAL(18)); +CREATE TABLE cs2 (d1 DECIMAL(18,10), d2 DECIMAL(18,10)); +CREATE TABLE cs3 (d1 DECIMAL(18,10), d2 DECIMAL(18,10)); +# CREATE TABLE cs4 (d1 DECIMAL(38) UNSIGNED, d2 DECIMAL(19) UNSIGNED); +# CREATE TABLE cs5 (d1 DECIMAL(38,10) UNSIGNED, d2 DECIMAL(19,10) UNSIGNED); +# CREATE TABLE cs6 (d1 DECIMAL(38,38) UNSIGNED, d2 DECIMAL(19,19) UNSIGNED); + +CALL signedinsertproc(); + +# Updates with constant values without a WHERE clause +UPDATE cs1 SET d1=12345, d2=1234; +UPDATE cs2 SET d1=123456.90123, d2=12345.01234; +UPDATE cs3 SET d1=0.12345, d2=0.1234; +SELECT "signedtest1", d1, d2 FROM cs1; +SELECT "signedtest1", d1, d2 FROM cs2; +SELECT "signedtest1", d1, d2 FROM cs3; + +# Updates with WHERE clause +# Update a single row with a constant value in WHERE clause +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=12345, d2=0 WHERE d1=-99998; +UPDATE cs1 SET d1=0, d2=12345 WHERE d2=9999; +UPDATE cs2 SET d1=123456.90123, d2=0 WHERE d1=-99999.99998; +UPDATE cs2 SET d1=0, d2=12345.012345678 WHERE d2=99999.99999; +UPDATE cs3 SET d1=0.12345, d2=0 WHERE d1=-0.99998; +UPDATE cs3 SET d1=0, d2=0.12345 WHERE d2=0.9999; +SELECT "signedtest2", d1, d2 FROM cs1; +SELECT "signedtest2", d1, d2 FROM cs2; +SELECT "signedtest2", d1, d2 FROM cs3; + +# Update multiple rows +# Updates with multiple constant values in WHERE clause +#CALL signeddeleteproc(); +#CALL signedinsertproc(); +#UPDATE cs1 SET d1=12345, d2=1234 WHERE d1 in (-99998, 99999); +#UPDATE cs2 SET d1=123456.90123, d2=12345.01234 WHERE d1 in (-99999.99998, 99999.99999); +#UPDATE cs3 SET d1=0.12345, d2=0.1234 WHERE d1 in (-0.99998, 0.99999); +#SELECT "signedtest3", d1, d2 FROM cs1; +#SELECT "signedtest3", d1, d2 FROM cs2; +#SELECT "signedtest3", d1, d2 FROM cs3; + +# Updates with comparison operators in WHERE clause +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=12345, d2=1234 WHERE d1 < -99998 OR d2 > 9998; +UPDATE cs2 SET d1=123456.90123, d2=12345.01234 WHERE d1 < -99999.99998 OR d2 > 99999.99998; +UPDATE cs3 SET d1=0.12345, d2=0.1234 WHERE d1 < -0.99998 OR d2 > 0.9998; +SELECT "signedtest4a", d1, d2 FROM cs1; +SELECT "signedtest4a", d1, d2 FROM cs2; +SELECT "signedtest4a", d1, d2 FROM cs3; +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=12345, d2=1234 WHERE d1 <= -99998 OR d2 >= 9998; +UPDATE cs2 SET d1=123456.90123, d2=12345.01234 WHERE d1 <= -99999.99998 OR d2 >= 99999.99998; +UPDATE cs3 SET d1=0.12345, d2=0.1234 WHERE d1 <= -0.99998 OR d2 >= 0.9998; +SELECT "signedtest4b", d1, d2 FROM cs1; +SELECT "signedtest4b", d1, d2 FROM cs2; +SELECT "signedtest4b", d1, d2 FROM cs3; + +# Update with NULL in the WHERE clause +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=12345, d2=1234 WHERE d1 is NULL; +UPDATE cs2 SET d1=123456.90123, d2=12345.01234 WHERE d1 is NULL; +UPDATE cs3 SET d1=0.12345, d2=0.1234 WHERE d1 is NULL; +SELECT "signedtest5", d1, d2 FROM cs1; +SELECT "signedtest5", d1, d2 FROM cs2; +SELECT "signedtest5", d1, d2 FROM cs3; + +# Update with != operator +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=12345, d2=1234 WHERE d1 != 125; +UPDATE cs2 SET d1=123456.90123, d2=12345.01234 WHERE d1 != 1.25; +UPDATE cs3 SET d1=0.12345, d2=0.1234 WHERE d1 != 0.125; +SELECT "signedtest6", d1, d2 FROM cs1; +SELECT "signedtest6", d1, d2 FROM cs2; +SELECT "signedtest6", d1, d2 FROM cs3; + +# Update with non-constant value in the WHERE clause +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d2=d1 WHERE d1 = d2; +UPDATE cs2 SET d2=d1 WHERE d1 = d2; +UPDATE cs3 SET d2=d1 WHERE d1 = d2; +SELECT "signedtest7", d1, d2 FROM cs1; +SELECT "signedtest7", d1, d2 FROM cs2; +SELECT "signedtest7", d1, d2 FROM cs3; +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=d2 WHERE d1 != d2; +UPDATE cs2 SET d1=d2 WHERE d1 != d2; +UPDATE cs3 SET d1=d2 WHERE d1 != d2; +SELECT "signedtest8", d1, d2 FROM cs1; +SELECT "signedtest8", d1, d2 FROM cs2; +SELECT "signedtest8", d1, d2 FROM cs3; +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=12345, d2=1234 WHERE d1 < d2; +UPDATE cs2 SET d1=123456.90123, d2=12345.01234 WHERE d1 < d2; +UPDATE cs3 SET d1=0.12345, d2=0.1234 WHERE d1 < d2; +SELECT "signedtest9", d1, d2 FROM cs1; +SELECT "signedtest9", d1, d2 FROM cs2; +SELECT "signedtest9", d1, d2 FROM cs3; +CALL signeddeleteproc(); +CALL signedinsertproc(); +UPDATE cs1 SET d1=d2 WHERE d1 > d2; +UPDATE cs2 SET d1=d2 WHERE d1 > d2; +UPDATE cs3 SET d1=d2 WHERE d1 > d2; +SELECT "signedtest10", d1, d2 FROM cs1; +SELECT "signedtest10", d1, d2 FROM cs2; +SELECT "signedtest10", d1, d2 FROM cs3; + +# Updates with functions and expressions in the WHERE clause + + +DROP PROCEDURE IF EXISTS signedinsertproc; +DROP PROCEDURE IF EXISTS signeddeleteproc; +DROP DATABASE update_signed_test;