Commit 59b0e145 authored by unknown's avatar unknown

Post-merge fix

parent 86267e67
......@@ -2961,6 +2961,16 @@ UPDATE t1 SET i= f1();
DROP FUNCTION f1;
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, val INT UNSIGNED NOT NULL);
CREATE VIEW v1 AS SELECT id, val FROM t1 WHERE val >= 1 AND val <= 5 WITH CHECK OPTION;
INSERT INTO v1 (val) VALUES (2);
INSERT INTO v1 (val) VALUES (4);
INSERT INTO v1 (val) VALUES (6);
ERROR HY000: CHECK OPTION failed 'test.v1'
UPDATE v1 SET val=6 WHERE id=2;
ERROR HY000: CHECK OPTION failed 'test.v1'
DROP VIEW v1;
DROP TABLE t1;
DROP VIEW IF EXISTS v1, v2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY, j INT);
......@@ -3117,50 +3127,6 @@ code COUNT(DISTINCT country)
DROP VIEW v1;
DROP TABLE t1;
End of 5.0 tests.
CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, val INT UNSIGNED NOT NULL);
CREATE VIEW v1 AS SELECT id, val FROM t1 WHERE val >= 1 AND val <= 5 WITH CHECK OPTION;
INSERT INTO v1 (val) VALUES (2);
INSERT INTO v1 (val) VALUES (4);
INSERT INTO v1 (val) VALUES (6);
ERROR HY000: CHECK OPTION failed 'test.v1'
UPDATE v1 SET val=6 WHERE id=2;
ERROR HY000: CHECK OPTION failed 'test.v1'
DROP VIEW v1;
DROP TABLE t1;
DROP VIEW IF EXISTS v1, v2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY, j INT);
CREATE VIEW v1 AS SELECT j FROM t1;
CREATE VIEW v2 AS SELECT * FROM t1;
INSERT INTO t1 (j) VALUES (1);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1
INSERT INTO v1 (j) VALUES (2);
# LAST_INSERT_ID() should not change.
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1
INSERT INTO v2 (j) VALUES (3);
# LAST_INSERT_ID() should be updated.
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
3
INSERT INTO v1 (j) SELECT j FROM t1;
# LAST_INSERT_ID() should not change.
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
3
SELECT * FROM t1;
i j
1 1
2 2
3 3
4 1
5 2
6 3
DROP VIEW v1, v2;
DROP TABLE t1;
DROP DATABASE IF EXISTS `d-1`;
CREATE DATABASE `d-1`;
USE `d-1`;
......
......@@ -748,12 +748,12 @@ drop view v1;
#
# VIEWs with national characters
#
create table tü (cü char);
create view vü as select cü from tü;
insert into vü values ('ü');
select * from vü;
drop view vü;
drop table tü;
create table t (c char);
create view v as select c from t;
insert into v values ('');
select * from v;
drop view v;
drop table t;
#
# problem with used_tables() of outer reference resolved in VIEW
......@@ -2899,6 +2899,20 @@ DROP FUNCTION f1;
DROP VIEW v1;
DROP TABLE t1;
#
# Bug #16813 (WITH CHECK OPTION doesn't work with UPDATE)
#
CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, val INT UNSIGNED NOT NULL);
CREATE VIEW v1 AS SELECT id, val FROM t1 WHERE val >= 1 AND val <= 5 WITH CHECK OPTION;
INSERT INTO v1 (val) VALUES (2);
INSERT INTO v1 (val) VALUES (4);
-- error 1369
INSERT INTO v1 (val) VALUES (6);
-- error 1369
UPDATE v1 SET val=6 WHERE id=2;
DROP VIEW v1;
DROP TABLE t1;
#
# BUG#22584: last_insert_id not updated after inserting a record
# through a updatable view
......@@ -2951,7 +2965,7 @@ DROP VIEW v;
#
# BUG#24293: '\Z' token is not handled correctly in views
#
--disable_warnings
DROP VIEW IF EXISTS v1;
--enable_warnings
......@@ -3037,56 +3051,6 @@ DROP TABLE t1;
--echo End of 5.0 tests.
# Bug #16813 (WITH CHECK OPTION doesn't work with UPDATE)
#
CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, val INT UNSIGNED NOT NULL);
CREATE VIEW v1 AS SELECT id, val FROM t1 WHERE val >= 1 AND val <= 5 WITH CHECK OPTION;
INSERT INTO v1 (val) VALUES (2);
INSERT INTO v1 (val) VALUES (4);
-- error 1369
INSERT INTO v1 (val) VALUES (6);
-- error 1369
UPDATE v1 SET val=6 WHERE id=2;
DROP VIEW v1;
DROP TABLE t1;
#
# BUG#22584: last_insert_id not updated after inserting a record
# through a updatable view
#
# We still do not update LAST_INSERT_ID if AUTO_INCREMENT column is
# not accessible through a view. However, we do not reset the value
# of LAST_INSERT_ID, but keep it unchanged.
#
--disable_warnings
DROP VIEW IF EXISTS v1, v2;
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY, j INT);
CREATE VIEW v1 AS SELECT j FROM t1;
CREATE VIEW v2 AS SELECT * FROM t1;
INSERT INTO t1 (j) VALUES (1);
SELECT LAST_INSERT_ID();
INSERT INTO v1 (j) VALUES (2);
--echo # LAST_INSERT_ID() should not change.
SELECT LAST_INSERT_ID();
INSERT INTO v2 (j) VALUES (3);
--echo # LAST_INSERT_ID() should be updated.
SELECT LAST_INSERT_ID();
INSERT INTO v1 (j) SELECT j FROM t1;
--echo # LAST_INSERT_ID() should not change.
SELECT LAST_INSERT_ID();
SELECT * FROM t1;
DROP VIEW v1, v2;
DROP TABLE t1;
#
# Bug#21370 View renaming lacks tablename_to_filename encoding
#
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment