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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
ae0a3e0d
Commit
ae0a3e0d
authored
Jul 04, 2006
by
gkodinov@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/kgeorge/mysql/5.0/teamclean
into mysql.com:/home/kgeorge/mysql/5.0/B16110
parents
3cc6d95d
b64089e6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
3 deletions
+48
-3
mysql-test/r/view.result
mysql-test/r/view.result
+15
-1
mysql-test/t/view.test
mysql-test/t/view.test
+19
-1
sql/sql_insert.cc
sql/sql_insert.cc
+14
-1
No files found.
mysql-test/r/view.result
View file @
ae0a3e0d
...
@@ -2735,4 +2735,18 @@ m e
...
@@ -2735,4 +2735,18 @@ m e
4 a
4 a
1 b
1 b
DROP VIEW v1;
DROP VIEW v1;
DROP TABLE IF EXISTS t1,t2;
DROP TABLE t1,t2;
CREATE TABLE t1 (a INT NOT NULL, b INT NULL DEFAULT NULL);
CREATE VIEW v1 AS SELECT a, b FROM t1;
INSERT INTO v1 (b) VALUES (2);
Warnings:
Warning 1423 Field of view 'test.v1' underlying table doesn't have a default value
SET SQL_MODE = STRICT_ALL_TABLES;
INSERT INTO v1 (b) VALUES (4);
ERROR HY000: Field of view 'test.v1' underlying table doesn't have a default value
SET SQL_MODE = '';
SELECT * FROM t1;
a b
0 2
DROP VIEW v1;
DROP TABLE t1;
mysql-test/t/view.test
View file @
ae0a3e0d
...
@@ -2595,4 +2595,22 @@ CREATE TABLE t2 SELECT * FROM v1;
...
@@ -2595,4 +2595,22 @@ CREATE TABLE t2 SELECT * FROM v1;
SELECT
*
FROM
t2
;
SELECT
*
FROM
t2
;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
IF
EXISTS
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
# Bug#16110: insert permitted into view col w/o default value
#
CREATE
TABLE
t1
(
a
INT
NOT
NULL
,
b
INT
NULL
DEFAULT
NULL
);
CREATE
VIEW
v1
AS
SELECT
a
,
b
FROM
t1
;
INSERT
INTO
v1
(
b
)
VALUES
(
2
);
SET
SQL_MODE
=
STRICT_ALL_TABLES
;
--
error
1423
INSERT
INTO
v1
(
b
)
VALUES
(
4
);
SET
SQL_MODE
=
''
;
SELECT
*
FROM
t1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
sql/sql_insert.cc
View file @
ae0a3e0d
...
@@ -674,6 +674,7 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view)
...
@@ -674,6 +674,7 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view)
uint
used_fields_buff_size
=
(
table
->
s
->
fields
+
7
)
/
8
;
uint
used_fields_buff_size
=
(
table
->
s
->
fields
+
7
)
/
8
;
uchar
*
used_fields_buff
=
(
uchar
*
)
thd
->
alloc
(
used_fields_buff_size
);
uchar
*
used_fields_buff
=
(
uchar
*
)
thd
->
alloc
(
used_fields_buff_size
);
MY_BITMAP
used_fields
;
MY_BITMAP
used_fields
;
bool
save_set_query_id
=
thd
->
set_query_id
;
DBUG_ENTER
(
"check_key_in_view"
);
DBUG_ENTER
(
"check_key_in_view"
);
if
(
!
used_fields_buff
)
if
(
!
used_fields_buff
)
...
@@ -686,15 +687,26 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view)
...
@@ -686,15 +687,26 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view)
bitmap_clear_all
(
&
used_fields
);
bitmap_clear_all
(
&
used_fields
);
view
->
contain_auto_increment
=
0
;
view
->
contain_auto_increment
=
0
;
/*
we must not set query_id for fields as they're not
really used in this context
*/
thd
->
set_query_id
=
0
;
/* check simplicity and prepare unique test of view */
/* check simplicity and prepare unique test of view */
for
(
trans
=
trans_start
;
trans
!=
trans_end
;
trans
++
)
for
(
trans
=
trans_start
;
trans
!=
trans_end
;
trans
++
)
{
{
if
(
!
trans
->
item
->
fixed
&&
trans
->
item
->
fix_fields
(
thd
,
&
trans
->
item
))
if
(
!
trans
->
item
->
fixed
&&
trans
->
item
->
fix_fields
(
thd
,
&
trans
->
item
))
return
TRUE
;
{
thd
->
set_query_id
=
save_set_query_id
;
DBUG_RETURN
(
TRUE
);
}
Item_field
*
field
;
Item_field
*
field
;
/* simple SELECT list entry (field without expression) */
/* simple SELECT list entry (field without expression) */
if
(
!
(
field
=
trans
->
item
->
filed_for_view_update
()))
if
(
!
(
field
=
trans
->
item
->
filed_for_view_update
()))
{
thd
->
set_query_id
=
save_set_query_id
;
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
}
if
(
field
->
field
->
unireg_check
==
Field
::
NEXT_NUMBER
)
if
(
field
->
field
->
unireg_check
==
Field
::
NEXT_NUMBER
)
view
->
contain_auto_increment
=
1
;
view
->
contain_auto_increment
=
1
;
/* prepare unique test */
/* prepare unique test */
...
@@ -704,6 +716,7 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view)
...
@@ -704,6 +716,7 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view)
*/
*/
trans
->
item
=
field
;
trans
->
item
=
field
;
}
}
thd
->
set_query_id
=
save_set_query_id
;
/* unique test */
/* unique test */
for
(
trans
=
trans_start
;
trans
!=
trans_end
;
trans
++
)
for
(
trans
=
trans_start
;
trans
!=
trans_end
;
trans
++
)
{
{
...
...
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