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
ad9a6e08
Commit
ad9a6e08
authored
Jul 21, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
error message interception (Bug#4598)
error handling of view initialization fixed (Bug#4599)
parent
77a230c6
Changes
30
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
85 additions
and
4 deletions
+85
-4
include/mysqld_error.h
include/mysqld_error.h
+2
-1
mysql-test/r/view.result
mysql-test/r/view.result
+10
-0
mysql-test/t/view.test
mysql-test/t/view.test
+14
-0
sql/share/czech/errmsg.txt
sql/share/czech/errmsg.txt
+1
-0
sql/share/danish/errmsg.txt
sql/share/danish/errmsg.txt
+1
-0
sql/share/dutch/errmsg.txt
sql/share/dutch/errmsg.txt
+1
-0
sql/share/english/errmsg.txt
sql/share/english/errmsg.txt
+1
-0
sql/share/estonian/errmsg.txt
sql/share/estonian/errmsg.txt
+1
-0
sql/share/french/errmsg.txt
sql/share/french/errmsg.txt
+1
-0
sql/share/german/errmsg.txt
sql/share/german/errmsg.txt
+1
-0
sql/share/greek/errmsg.txt
sql/share/greek/errmsg.txt
+1
-0
sql/share/hungarian/errmsg.txt
sql/share/hungarian/errmsg.txt
+1
-0
sql/share/italian/errmsg.txt
sql/share/italian/errmsg.txt
+1
-0
sql/share/japanese/errmsg.txt
sql/share/japanese/errmsg.txt
+1
-0
sql/share/korean/errmsg.txt
sql/share/korean/errmsg.txt
+1
-0
sql/share/norwegian-ny/errmsg.txt
sql/share/norwegian-ny/errmsg.txt
+1
-0
sql/share/norwegian/errmsg.txt
sql/share/norwegian/errmsg.txt
+1
-0
sql/share/polish/errmsg.txt
sql/share/polish/errmsg.txt
+1
-0
sql/share/portuguese/errmsg.txt
sql/share/portuguese/errmsg.txt
+1
-0
sql/share/romanian/errmsg.txt
sql/share/romanian/errmsg.txt
+1
-0
sql/share/russian/errmsg.txt
sql/share/russian/errmsg.txt
+1
-0
sql/share/serbian/errmsg.txt
sql/share/serbian/errmsg.txt
+1
-0
sql/share/slovak/errmsg.txt
sql/share/slovak/errmsg.txt
+1
-0
sql/share/spanish/errmsg.txt
sql/share/spanish/errmsg.txt
+1
-0
sql/share/swedish/errmsg.txt
sql/share/swedish/errmsg.txt
+1
-0
sql/share/ukrainian/errmsg.txt
sql/share/ukrainian/errmsg.txt
+1
-0
sql/sql_base.cc
sql/sql_base.cc
+9
-2
sql/sql_view.cc
sql/sql_view.cc
+11
-1
sql/table.cc
sql/table.cc
+14
-0
sql/table.h
sql/table.h
+2
-0
No files found.
include/mysqld_error.h
View file @
ad9a6e08
...
...
@@ -370,4 +370,5 @@
#define ER_VIEW_WRONG_LIST 1351
#define ER_WARN_VIEW_MERGE 1352
#define ER_WARN_VIEW_WITHOUT_KEY 1353
#define ER_ERROR_MESSAGES 354
#define ER_VIEW_INVALID 1354
#define ER_ERROR_MESSAGES 355
mysql-test/r/view.result
View file @
ad9a6e08
...
...
@@ -965,3 +965,13 @@ Field Type Null Key Default Extra
col1 char(2) YES NULL
drop view v1;
drop table `t1a``b`;
create table t1 (col1 char(5),col2 char(5));
create view v1 as select * from t1;
drop table t1;
create table t1 (col1 char(5),newcol2 char(5));
insert into v1 values('a','aa');
ERROR HY000: View 'test.v1' references invalid table(s) or column(s)
drop table t1;
select * from v1;
ERROR HY000: View 'test.v1' references invalid table(s) or column(s)
drop view v1;
mysql-test/t/view.test
View file @
ad9a6e08
...
...
@@ -880,3 +880,17 @@ select * from v1;
describe
v1
;
drop
view
v1
;
drop
table
`t1a``b`
;
#
# Changing of underlaying table
#
create
table
t1
(
col1
char
(
5
),
col2
char
(
5
));
create
view
v1
as
select
*
from
t1
;
drop
table
t1
;
create
table
t1
(
col1
char
(
5
),
newcol2
char
(
5
));
--
error
1354
insert
into
v1
values
(
'a'
,
'aa'
);
drop
table
t1
;
--
error
1354
select
*
from
v1
;
drop
view
v1
;
sql/share/czech/errmsg.txt
View file @
ad9a6e08
...
...
@@ -366,3 +366,4 @@ character-set=latin2
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/danish/errmsg.txt
View file @
ad9a6e08
...
...
@@ -360,3 +360,4 @@ character-set=latin1
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/dutch/errmsg.txt
View file @
ad9a6e08
...
...
@@ -368,3 +368,4 @@ character-set=latin1
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/english/errmsg.txt
View file @
ad9a6e08
...
...
@@ -357,3 +357,4 @@ character-set=latin1
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/estonian/errmsg.txt
View file @
ad9a6e08
...
...
@@ -362,3 +362,4 @@ character-set=latin7
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/french/errmsg.txt
View file @
ad9a6e08
...
...
@@ -357,3 +357,4 @@ character-set=latin1
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/german/errmsg.txt
View file @
ad9a6e08
...
...
@@ -369,3 +369,4 @@ character-set=latin1
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/greek/errmsg.txt
View file @
ad9a6e08
...
...
@@ -357,3 +357,4 @@ character-set=greek
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/hungarian/errmsg.txt
View file @
ad9a6e08
...
...
@@ -359,3 +359,4 @@ character-set=latin2
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/italian/errmsg.txt
View file @
ad9a6e08
...
...
@@ -357,3 +357,4 @@ character-set=latin1
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/japanese/errmsg.txt
View file @
ad9a6e08
...
...
@@ -359,3 +359,4 @@ character-set=ujis
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/korean/errmsg.txt
View file @
ad9a6e08
...
...
@@ -357,3 +357,4 @@ character-set=euckr
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/norwegian-ny/errmsg.txt
View file @
ad9a6e08
...
...
@@ -359,3 +359,4 @@ character-set=latin1
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/norwegian/errmsg.txt
View file @
ad9a6e08
...
...
@@ -359,3 +359,4 @@ character-set=latin1
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/polish/errmsg.txt
View file @
ad9a6e08
...
...
@@ -361,3 +361,4 @@ character-set=latin2
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/portuguese/errmsg.txt
View file @
ad9a6e08
...
...
@@ -358,3 +358,4 @@ character-set=latin1
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/romanian/errmsg.txt
View file @
ad9a6e08
...
...
@@ -361,3 +361,4 @@ character-set=latin2
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/russian/errmsg.txt
View file @
ad9a6e08
...
...
@@ -359,3 +359,4 @@ character-set=koi8r
"View SELECT view "
" view ( )"
" view ()"
"View '%-.64s.%-.64s' "
sql/share/serbian/errmsg.txt
View file @
ad9a6e08
...
...
@@ -363,3 +363,4 @@ character-set=cp1250
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/slovak/errmsg.txt
View file @
ad9a6e08
...
...
@@ -365,3 +365,4 @@ character-set=latin2
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/spanish/errmsg.txt
View file @
ad9a6e08
...
...
@@ -359,3 +359,4 @@ character-set=latin1
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/swedish/errmsg.txt
View file @
ad9a6e08
...
...
@@ -357,3 +357,4 @@ character-set=latin1
"View's SELECT and view's field list have different column counts"
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
sql/share/ukrainian/errmsg.txt
View file @
ad9a6e08
...
...
@@ -362,3 +362,4 @@ character-set=koi8u
"View SELECT ̦ æ view Ҧ ˦˦ æ"
" view ( )"
"View, , ͦ æ(), Ҧ "
"View '%-.64s.%-.64s' Ŧަ æ æ"
sql/sql_base.cc
View file @
ad9a6e08
...
...
@@ -1505,6 +1505,13 @@ memory to write 'DELETE FROM `%s`.`%s`' to the binary log",db,name);
}
DBUG_RETURN
(
0
);
err:
/* Hide "Table doesn't exist" errors if table belong to view */
if
(
thd
->
net
.
last_errno
==
ER_NO_SUCH_TABLE
&&
table_desc
->
belong_to_view
)
{
TABLE_LIST
*
view
=
table_desc
->
belong_to_view
;
thd
->
clear_error
();
my_error
(
ER_VIEW_INVALID
,
MYF
(
0
),
view
->
view_db
.
str
,
view
->
view_name
.
str
);
}
DBUG_RETURN
(
1
);
}
...
...
@@ -2511,8 +2518,8 @@ bool setup_tables(THD *thd, TABLE_LIST *tables, Item **conds)
table
->
keys_in_use_for_query
.
subtract
(
map
);
}
table
->
used_keys
.
intersect
(
table
->
keys_in_use_for_query
);
if
(
table_list
->
ancestor
)
table_list
->
setup_ancestor
(
thd
,
conds
);
if
(
table_list
->
ancestor
&&
table_list
->
setup_ancestor
(
thd
,
conds
)
)
DBUG_RETURN
(
1
);
}
if
(
tablenr
>
MAX_TABLES
)
{
...
...
sql/sql_view.cc
View file @
ad9a6e08
...
...
@@ -483,6 +483,10 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
mysql_make_view()
parser - parser object;
table - TABLE_LIST structure for filling
RETURN
TRUE OK
FALSE error
*/
my_bool
mysql_make_view
(
File_parser
*
parser
,
TABLE_LIST
*
table
)
...
...
@@ -576,6 +580,9 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
}
if
(
!
res
&&
!
thd
->
is_fatal_error
)
{
TABLE_LIST
*
top_view
=
(
table
->
belong_to_view
?
table
->
belong_to_view
:
table
);
/* move SP to main LEX */
sp_merge_funs
(
old_lex
,
lex
);
...
...
@@ -586,9 +593,12 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
if
((
table
->
next_global
=
lex
->
query_tables
))
table
->
next_global
->
prev_global
=
&
table
->
next_global
;
/* mark to avoid temporary table using */
/* mark to avoid temporary table using
and put view reference
*/
for
(
TABLE_LIST
*
tbl
=
table
->
next_global
;
tbl
;
tbl
=
tbl
->
next_global
)
{
tbl
->
skip_temporary
=
1
;
tbl
->
belong_to_view
=
top_view
;
}
/*
check rights to run commands (EXPLAIN SELECT & SHOW CREATE) which show
...
...
sql/table.cc
View file @
ad9a6e08
...
...
@@ -1500,6 +1500,7 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
{
Item
**
transl
;
SELECT_LEX
*
select
=
&
view
->
select_lex
;
SELECT_LEX
*
current_select_save
=
thd
->
lex
->
current_select
;
Item
*
item
;
List_iterator_fast
<
Item
>
it
(
select
->
item_list
);
uint
i
=
0
;
...
...
@@ -1512,6 +1513,8 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
if
(
field_translation
)
{
/* prevent look up in SELECTs tree */
thd
->
lex
->
current_select
=
&
thd
->
lex
->
select_lex
;
thd
->
set_query_id
=
1
;
/* this view was prepared already on previous PS/SP execution */
Item
**
end
=
field_translation
+
select
->
item_list
.
elements
;
...
...
@@ -1536,6 +1539,9 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
{
DBUG_RETURN
(
1
);
}
/* prevent look up in SELECTs tree */
thd
->
lex
->
current_select
=
&
thd
->
lex
->
select_lex
;
/*
Resolve all view items against ancestor table.
...
...
@@ -1590,10 +1596,18 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds)
}
ok:
thd
->
lex
->
current_select
=
current_select_save
;
thd
->
set_query_id
=
save_set_query_id
;
DBUG_RETURN
(
0
);
err:
/* Hide "Unknown column" error */
if
(
thd
->
net
.
last_errno
==
ER_BAD_FIELD_ERROR
)
{
thd
->
clear_error
();
my_error
(
ER_VIEW_INVALID
,
MYF
(
0
),
view_db
.
str
,
view_name
.
str
);
}
thd
->
lex
->
current_select
=
current_select_save
;
thd
->
set_query_id
=
save_set_query_id
;
DBUG_RETURN
(
1
);
}
...
...
sql/table.h
View file @
ad9a6e08
...
...
@@ -205,6 +205,8 @@ typedef struct st_table_list
Item
**
field_translation
;
/* array of VIEW fields */
/* ancestor of this table (VIEW merge algorithm) */
st_table_list
*
ancestor
;
/* most upper view this table belongs to */
st_table_list
*
belong_to_view
;
Item
*
where
;
/* VIEW WHERE clause condition */
LEX_STRING
query
;
/* text of (CRETE/SELECT) statement */
LEX_STRING
md5
;
/* md5 of query tesxt */
...
...
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