Commit 5ddb380a authored by unknown's avatar unknown

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0

into sanja.is.com.ua:/home/bell/mysql/bk/work-multi-5.0


mysql-test/r/view.result:
  Auto merged
mysql-test/t/view.test:
  Auto merged
sql/sql_view.cc:
  Auto merged
parents 145b6d72 cf740f0e
......@@ -58,7 +58,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"../client_release/mysqld-opt.exe"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"../client_release/mysqld.exe"
# SUBTRACT LINK32 /debug
!ELSEIF "$(CFG)" == "mysqld - Win32 Debug"
......@@ -84,7 +84,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_debug\dbug.lib ..\lib_debug\vio.lib ..\lib_debug\mysys.lib ..\lib_debug\strings.lib ..\lib_debug\regex.lib ..\lib_debug\heap.lib ..\lib_debug\bdb.lib ..\lib_debug\innodb.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqld.exe" /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_debug\dbug.lib ..\lib_debug\vio.lib ..\lib_debug\mysys.lib ..\lib_debug\strings.lib ..\lib_debug\regex.lib ..\lib_debug\heap.lib ..\lib_debug\bdb.lib ..\lib_debug\innodb.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqld-debug.exe" /pdbtype:sept
!ELSEIF "$(CFG)" == "mysqld - Win32 nt"
......
......@@ -2218,13 +2218,14 @@ static my_bool dump_all_views_in_db(char *database)
different case (e.g. T1 vs t1)
RETURN
void
int - 0 if a tablename was retrieved. 1 if not
*/
static void get_actual_table_name(const char *old_table_name,
static int get_actual_table_name(const char *old_table_name,
char *new_table_name,
int buf_size)
{
int retval;
MYSQL_RES *tableRes;
MYSQL_ROW row;
char query[50 + 2*NAME_LEN];
......@@ -2242,9 +2243,19 @@ static void get_actual_table_name(const char *old_table_name,
}
tableRes= mysql_store_result( sock );
retval = 1;
if (tableRes != NULL)
{
my_ulonglong numRows = mysql_num_rows(tableRes);
if (numRows > 0)
{
row= mysql_fetch_row( tableRes );
strmake(new_table_name, row[0], buf_size-1);
retval = 0;
}
mysql_free_result(tableRes);
}
return retval;
}
......@@ -2284,11 +2295,13 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
char new_table_name[NAME_LEN];
/* the table name passed on commandline may be wrong case */
get_actual_table_name( table_names[i], new_table_name, sizeof(new_table_name) );
if (!get_actual_table_name( table_names[i], new_table_name, sizeof(new_table_name) ))
{
numrows = getTableStructure(new_table_name, db);
dumpTable(numrows, new_table_name);
}
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
order_by= 0;
}
......
......@@ -24,6 +24,20 @@ n
drop database if exists mysqltest;
affected rows: 1
create database mysqltest;
use mysqltest;
drop table table1, table2, table3, table4, table5, table6,
table7, table8, table9, table10, table11, table12, table13,
table14, table15, table16, table17, table18, table19, table20,
table21, table22, table23, table24, table25, table26, table27,
table28;
ERROR 42S02: Unknown table 'table1,table2,table3,table4,table5,table6,table7,table8,table9,table10,table11,table12,table13,table14,table15,table16,table17,table18,table19,table20,table21,table22,table23,table'
drop table table1, table2, table3, table4, table5, table6,
table7, table8, table9, table10, table11, table12, table13,
table14, table15, table16, table17, table18, table19, table20,
table21, table22, table23, table24, table25, table26, table27,
table28, table29, table30;
ERROR 42S02: Unknown table 'table1,table2,table3,table4,table5,table6,table7,table8,table9,table10,table11,table12,table13,table14,table15,table16,table17,table18,table19,table20,table21,table22,table23,table'
use test;
drop database mysqltest;
flush tables with read lock;
create database mysqltest;
......
......@@ -2,6 +2,9 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
auto int(5) unsigned NOT NULL auto_increment,
string char(10) default "hello",
vstring varchar(10) default "hello",
bin binary(7),
vbin varbinary(7),
tiny tinyint(4) DEFAULT '0' NOT NULL ,
short smallint(6) DEFAULT '1' NOT NULL ,
medium mediumint(8) DEFAULT '0' NOT NULL,
......@@ -9,17 +12,20 @@ long_int int(11) DEFAULT '0' NOT NULL,
longlong bigint(13) DEFAULT '0' NOT NULL,
real_float float(13,1) DEFAULT 0.0 NOT NULL,
real_double double(16,4),
real_decimal decimal(16,4),
utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
ulong int(11) unsigned DEFAULT '0' NOT NULL,
ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
time_stamp timestamp,
bits bit(3),
options enum('one','two','tree') not null,
flags set('one','two','tree') not null,
date_field date,
year_field year,
time_field time,
date_time datetime,
options enum('one','two','tree') not null,
flags set('one','two','tree') not null,
time_stamp timestamp not null default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (auto),
KEY (utiny),
KEY (tiny),
......@@ -33,4 +39,37 @@ KEY (ulong),
KEY (ulonglong,ulong),
KEY (options,flags)
);
set @now = now();
insert into t1
(string,vstring,bin,vbin,tiny,short,medium,long_int,longlong,
real_float,real_double, real_decimal,utiny, ushort, umedium,ulong,ulonglong,
bits,options,flags,date_field,year_field,time_field,date_time)
values
("aaaa","aaaa",0xAAAA,0xAAAA,-1,-1,-1,-1,-1,1.1,1.1,1.1,1,1,1,1,1,
b'001','one','one', '1901-01-01','1901','01:01:01','1901-01-01 01:01:01');
select auto,string,vstring,bin,vbin,tiny,short,medium,long_int,longlong,
real_float,real_double,real_decimal,utiny,ushort,umedium,ulong,ulonglong,
bits,options,flags,date_field,year_field,time_field,date_time
from t1;
auto string vstring bin vbin tiny short medium long_int longlong real_float real_double real_decimal utiny ushort umedium ulong ulonglong bits options flags date_field year_field time_field date_time
1 aaaa aaaa -1 -1 -1 -1 -1 1.1 1.1000 1.1000 1 00001 1 1 1  one one 1901-01-01 1901 01:01:01 1901-01-01 01:01:01
select time_stamp>@now from t1;
time_stamp>@now
1
set @now = now();
update t1 set string="bbbb",vstring="bbbb",bin=0xBBBB,vbin=0xBBBB,
tiny=-2,short=-2,medium=-2,long_int=-2,longlong=-2,real_float=2.2,
real_double=2.2,real_decimal=2.2,utiny=2,ushort=2,umedium=2,ulong=2,
ulonglong=2, bits=b'010',
options='one',flags='one', date_field='1902-02-02',year_field='1902',
time_field='02:02:02',date_time='1902-02-02 02:02:02' where auto=1;
select auto,string,vstring,bin,vbin,tiny,short,medium,long_int,longlong,
real_float,real_double,real_decimal,utiny,ushort,umedium,ulong,ulonglong,
bits,options,flags,date_field,year_field,time_field,date_time
from t1;
auto string vstring bin vbin tiny short medium long_int longlong real_float real_double real_decimal utiny ushort umedium ulong ulonglong bits options flags date_field year_field time_field date_time
1 bbbb bbbb -2 -2 -2 -2 -2 2.2 2.2000 2.2000 2 00002 2 2 2  one one 1902-02-02 1902 02:02:02 1902-02-02 02:02:02
select time_stamp>@now from t1;
time_stamp>@now
1
drop table t1;
......@@ -237,13 +237,17 @@ grant select on mysqltest.t1 to mysqltest_1@localhost;
grant create view,select on test.* to mysqltest_1@localhost;
create view v1 as select * from mysqltest.t1;
alter view v1 as select * from mysqltest.t1;
ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table 'v1'
ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 'v1'
create or replace view v1 as select * from mysqltest.t1;
ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table 'v1'
ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 'v1'
create view mysqltest.v2 as select * from mysqltest.t1;
ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2'
create view v2 as select * from mysqltest.t2;
ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2'
grant create view,drop,select on test.* to mysqltest_1@localhost;
use test;
alter view v1 as select * from mysqltest.t1;
create or replace view v1 as select * from mysqltest.t1;
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
revoke all privileges on test.* from mysqltest_1@localhost;
drop database mysqltest;
......
......@@ -30,6 +30,28 @@ select * from mysqltest.mysqltest;
drop database if exists mysqltest;
--disable_info
create database mysqltest;
#
# drop many tables - bug#3891
# we'll do it in mysqltest db, to be able to use longer table names
# (tableN instead on tN)
#
use mysqltest;
--error 1051
drop table table1, table2, table3, table4, table5, table6,
table7, table8, table9, table10, table11, table12, table13,
table14, table15, table16, table17, table18, table19, table20,
table21, table22, table23, table24, table25, table26, table27,
table28;
--error 1051
drop table table1, table2, table3, table4, table5, table6,
table7, table8, table9, table10, table11, table12, table13,
table14, table15, table16, table17, table18, table19, table20,
table21, table22, table23, table24, table25, table26, table27,
table28, table29, table30;
use test;
drop database mysqltest;
# test drop/create database and FLUSH TABLES WITH READ LOCK
......
......@@ -7,10 +7,12 @@ DROP TABLE IF EXISTS t1;
#
# Test creation of different column types in NDB
#
CREATE TABLE t1 (
auto int(5) unsigned NOT NULL auto_increment,
string char(10) default "hello",
vstring varchar(10) default "hello",
bin binary(7),
vbin varbinary(7),
tiny tinyint(4) DEFAULT '0' NOT NULL ,
short smallint(6) DEFAULT '1' NOT NULL ,
medium mediumint(8) DEFAULT '0' NOT NULL,
......@@ -18,17 +20,20 @@ CREATE TABLE t1 (
longlong bigint(13) DEFAULT '0' NOT NULL,
real_float float(13,1) DEFAULT 0.0 NOT NULL,
real_double double(16,4),
real_decimal decimal(16,4),
utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
ulong int(11) unsigned DEFAULT '0' NOT NULL,
ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
time_stamp timestamp,
bits bit(3),
options enum('one','two','tree') not null,
flags set('one','two','tree') not null,
date_field date,
year_field year,
time_field time,
date_time datetime,
options enum('one','two','tree') not null,
flags set('one','two','tree') not null,
time_stamp timestamp not null default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (auto),
KEY (utiny),
KEY (tiny),
......@@ -43,5 +48,35 @@ CREATE TABLE t1 (
KEY (options,flags)
);
set @now = now();
sleep 1;
insert into t1
(string,vstring,bin,vbin,tiny,short,medium,long_int,longlong,
real_float,real_double, real_decimal,utiny, ushort, umedium,ulong,ulonglong,
bits,options,flags,date_field,year_field,time_field,date_time)
values
("aaaa","aaaa",0xAAAA,0xAAAA,-1,-1,-1,-1,-1,1.1,1.1,1.1,1,1,1,1,1,
b'001','one','one', '1901-01-01','1901','01:01:01','1901-01-01 01:01:01');
select auto,string,vstring,bin,vbin,tiny,short,medium,long_int,longlong,
real_float,real_double,real_decimal,utiny,ushort,umedium,ulong,ulonglong,
bits,options,flags,date_field,year_field,time_field,date_time
from t1;
select time_stamp>@now from t1;
set @now = now();
sleep 1;
update t1 set string="bbbb",vstring="bbbb",bin=0xBBBB,vbin=0xBBBB,
tiny=-2,short=-2,medium=-2,long_int=-2,longlong=-2,real_float=2.2,
real_double=2.2,real_decimal=2.2,utiny=2,ushort=2,umedium=2,ulong=2,
ulonglong=2, bits=b'010',
options='one',flags='one', date_field='1902-02-02',year_field='1902',
time_field='02:02:02',date_time='1902-02-02 02:02:02' where auto=1;
select auto,string,vstring,bin,vbin,tiny,short,medium,long_int,longlong,
real_float,real_double,real_decimal,utiny,ushort,umedium,ulong,ulonglong,
bits,options,flags,date_field,year_field,time_field,date_time
from t1;
select time_stamp>@now from t1;
drop table t1;
......@@ -181,7 +181,7 @@ connect (user1,localhost,mysqltest_1,,test);
connection user1;
create view v1 as select * from mysqltest.t1;
# try to modify view without DELETE privilege on it
# try to modify view without DROP privilege on it
-- error 1142
alter view v1 as select * from mysqltest.t1;
-- error 1142
......@@ -193,6 +193,16 @@ create view mysqltest.v2 as select * from mysqltest.t1;
-- error 1142
create view v2 as select * from mysqltest.t2;
connection root;
grant create view,drop,select on test.* to mysqltest_1@localhost;
connection user1;
# following 'use' command is workaround of bug #9582 and should be removed
# when that bug will be fixed
use test;
alter view v1 as select * from mysqltest.t1;
create or replace view v1 as select * from mysqltest.t1;
connection root;
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
revoke all privileges on test.* from mysqltest_1@localhost;
......
......@@ -2053,7 +2053,11 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
statistic_increment(thd->status_var.ha_update_count, &LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
{
table->timestamp_field->set_time();
// Set query_id so that field is really updated
table->timestamp_field->query_id= thd->query_id;
}
/* Check for update of primary key for special handling */
if ((table->s->primary_key != MAX_KEY) &&
......
......@@ -1214,30 +1214,30 @@ ER_TABLE_EXISTS_ERROR 42S01
swe "Tabellen '%-.64s' finns redan"
ukr " '%-.64s' դ"
ER_BAD_TABLE_ERROR 42S02
cze "Nezn-Bm tabulka '%-.64s'"
dan "Ukendt tabel '%-.64s'"
nla "Onbekende tabel '%-.64s'"
eng "Unknown table '%-.64s'"
jps "table '%-.64s' ͂܂.",
est "Tundmatu tabel '%-.64s'"
fre "Table '%-.64s' inconnue"
ger "Unbekannte Tabelle '%-.64s'"
greek " '%-.64s'"
hun "Ervenytelen tabla: '%-.64s'"
ita "Tabella '%-.64s' sconosciuta"
jpn "table '%-.64s' Ϥޤ."
kor "̺ '%-.64s' ˼ "
nor "Ukjent tabell '%-.64s'"
norwegian-ny "Ukjent tabell '%-.64s'"
pol "Nieznana tabela '%-.64s'"
por "Tabela '%-.64s' desconhecida"
rum "Tabela '%-.64s' este invalida"
rus " '%-.64s'"
serbian "Nepoznata tabela '%-.64s'"
slo "Neznma tabuka '%-.64s'"
spa "Tabla '%-.64s' desconocida"
swe "Oknd tabell '%-.64s'"
ukr "צ '%-.64s'"
cze "Nezn-Bm tabulka '%-.180s'"
dan "Ukendt tabel '%-.180s'"
nla "Onbekende tabel '%-.180s'"
eng "Unknown table '%-.180s'"
jps "table '%-.180s' ͂܂.",
est "Tundmatu tabel '%-.180s'"
fre "Table '%-.180s' inconnue"
ger "Unbekannte Tabelle '%-.180s'"
greek " '%-.180s'"
hun "Ervenytelen tabla: '%-.180s'"
ita "Tabella '%-.180s' sconosciuta"
jpn "table '%-.180s' Ϥޤ."
kor "̺ '%-.180s' ˼ "
nor "Ukjent tabell '%-.180s'"
norwegian-ny "Ukjent tabell '%-.180s'"
pol "Nieznana tabela '%-.180s'"
por "Tabela '%-.180s' desconhecida"
rum "Tabela '%-.180s' este invalida"
rus " '%-.180s'"
serbian "Nepoznata tabela '%-.180s'"
slo "Neznma tabuka '%-.180s'"
spa "Tabla '%-.180s' desconocida"
swe "Oknd tabell '%-.180s'"
ukr "צ '%-.180s'"
ER_NON_UNIQ_ERROR 23000
cze "Sloupec '%-.64s' v %s nen-B zcela jasn"
dan "Felt: '%-.64s' i tabel %s er ikke entydigt"
......
......@@ -273,7 +273,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
if (wrong_tables.length())
{
if (!foreign_key_error)
my_error(ER_BAD_TABLE_ERROR, MYF(0), wrong_tables.c_ptr());
my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
wrong_tables.c_ptr());
else
my_message(ER_ROW_IS_REFERENCED, ER(ER_ROW_IS_REFERENCED), MYF(0));
error= 1;
......
......@@ -88,14 +88,14 @@ bool mysql_create_view(THD *thd,
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
Privilege check for view creation:
- user have CREATE VIEW privilege on view table
- user have DELETE privilege in case of ALTER VIEW or CREATE OR REPLACE
- user has CREATE VIEW privilege on view table
- user has DROP privilege in case of ALTER VIEW or CREATE OR REPLACE
VIEW
- have some (SELECT/UPDATE/INSERT/DELETE) privileges on columns of
- user has some (SELECT/UPDATE/INSERT/DELETE) privileges on columns of
underlying tables used on top of SELECT list (because it can be
(theoretically) updated, so it is enough to have UPDATE privilege on
them, for example)
- have SELECT privilege on columns used in expressions of VIEW select
- user has SELECT privilege on columns used in expressions of VIEW select
- for columns of underly tables used on top of SELECT list also will be
checked that we have not more privileges on correspondent column of view
table (i.e. user will not get some privileges by view creation)
......@@ -104,9 +104,9 @@ bool mysql_create_view(THD *thd,
0, 0) ||
grant_option && check_grant(thd, CREATE_VIEW_ACL, view, 0, 1, 0)) ||
(mode != VIEW_CREATE_NEW &&
(check_access(thd, DELETE_ACL, view->db, &view->grant.privilege,
(check_access(thd, DROP_ACL, view->db, &view->grant.privilege,
0, 0) ||
grant_option && check_grant(thd, DELETE_ACL, view, 0, 1, 0))))
grant_option && check_grant(thd, DROP_ACL, view, 0, 1, 0))))
DBUG_RETURN(TRUE);
for (sl= select_lex; sl; sl= sl->next_select())
{
......
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