summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2006-09-29 01:00:18 +0400
committerunknown <evgen@moonbone.local>2006-09-29 01:00:18 +0400
commitd332c37c584e294aa22e570808d8c3ac44f743ba (patch)
treeb3eca40b7038ad6c2703515de7f2ba8923e66f2b /sql/sql_base.cc
parent665ebc05d07d39eccedd754d2625e2651c23888a (diff)
downloadmariadb-git-d332c37c584e294aa22e570808d8c3ac44f743ba.tar.gz
Fixed bug#5505: Wrong error message on INSERT into a view
On an INSERT into an updatable but non-insertable view an error message was issued stating the view being not updatable. This can lead to a confusion of a user. A new error message is introduced. Is is showed when a user tries to insert into a non-insertable view. sql/sql_base.cc: Fixed bug#5505: Wrong error message on INSERT into a view The update_non_unique_table_error() function now issues proper error for an INSERT. sql/sql_insert.cc: Fixed bug#5505: Wrong error message on INSERT into a view Issue the ER_NON_INSERTABLE_TABLE error instead of the ER_NON_UPDATABLE_TABLE on insert into a view. sql/sql_view.cc: Fixed bug#5505: Wrong error message on INSERT into a view Issue the ER_NON_INSERTABLE_TABLE error instead of the ER_NON_UPDATABLE_TABLE on insert into a view. mysql-test/r/view.result: Added the test case for bug#5505: Wrong error message on INSERT into a view Corrected a few test cases after fixing bug#5505 mysql-test/t/view.test: Added the test case for bug#5505: Wrong error message on INSERT into a view Corrected a few test cases after fixing bug#5505 sql/share/errmsg.txt: Fixed bug#5505: Wrong error message on INSERT into a view Added the ER_NON_INSERTABLE_TABLE error definition.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index c29c610b200..85be84d1270 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -902,8 +902,11 @@ void update_non_unique_table_error(TABLE_LIST *update,
*/
if (update->view)
{
+ /* Issue the ER_NON_INSERTABLE_TABLE error for an INSERT */
if (update->view == duplicate->view)
- my_error(ER_NON_UPDATABLE_TABLE, MYF(0), update->alias, operation);
+ my_error(!strncmp(operation, "INSERT", 6) ?
+ ER_NON_INSERTABLE_TABLE : ER_NON_UPDATABLE_TABLE, MYF(0),
+ update->alias, operation);
else
my_error(ER_VIEW_PREVENT_UPDATE, MYF(0),
(duplicate->view ? duplicate->alias : update->alias),