Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
59b0e145
Commit
59b0e145
authored
Feb 13, 2007
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Post-merge fix
parent
86267e67
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
101 deletions
+31
-101
mysql-test/r/view.result
mysql-test/r/view.result
+10
-44
mysql-test/t/view.test
mysql-test/t/view.test
+21
-57
No files found.
mysql-test/r/view.result
View file @
59b0e145
...
...
@@ -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`;
...
...
mysql-test/t/view.test
View file @
59b0e145
...
...
@@ -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
...
...
@@ -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
#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment