Commit 9acfd21f authored by unknown's avatar unknown

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1

into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb

parents 39e9830f fa99e347
......@@ -38,3 +38,25 @@ AC_DEFUN([AC_SYS_OS_COMPILER_FLAG],
fi
])
AC_DEFUN([AC_CHECK_NOEXECSTACK],
[
AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
mysql_cv_as_noexecstack, [dnl
cat > conftest.c <<EOF
void foo (void) { }
EOF
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
-S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
&& grep .note.GNU-stack conftest.s >/dev/null \
&& AC_TRY_COMMAND([${CC-cc} $CCASFLAGS $CPPFLAGS -Wa,--noexecstack
-c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
then
mysql_cv_as_noexecstack=yes
else
mysql_cv_as_noexecstack=no
fi
rm -f conftest*])
if test $mysql_cv_as_noexecstack = yes; then
CCASFLAGS="$CCASFLAGS -Wa,--noexecstack"
fi
])
......@@ -482,6 +482,10 @@ AM_PROG_CC_STDC
# We need an assembler, too
AM_PROG_AS
CCASFLAGS="$CCASFLAGS $ASFLAGS"
# Check if we need noexec stack for assembler
AC_CHECK_NOEXECSTACK
if test "$am_cv_prog_cc_stdc" = "no"
then
......
......@@ -690,3 +690,8 @@ CREATE TABLE t1 (a int PRIMARY KEY);
INSERT INTO t1 values (1), (2);
INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
DROP TABLE t1;
CREATE TABLE t1 (x int, y int);
CREATE TABLE t2 (z int, y int);
CREATE TABLE t3 (a int, b int);
INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1);
DROP TABLE IF EXISTS t1,t2,t3;
......@@ -330,6 +330,16 @@ alter table t1 add key (c1,c1,c2);
ERROR 42S21: Duplicate column name 'c1'
drop table t1;
create table t1 (
i1 INT NOT NULL,
i2 INT NOT NULL,
UNIQUE i1idx (i1),
UNIQUE i2idx (i2));
desc t1;
Field Type Null Key Default Extra
i1 int(11) NO UNI
i2 int(11) NO UNI
drop table t1;
create table t1 (
c1 int,
c2 varchar(20) not null,
primary key (c1),
......
......@@ -649,3 +649,15 @@ DROP VIEW mysqltest_db1.view1;
DROP TABLE mysqltest_db1.t1;
DROP SCHEMA mysqltest_db1;
DROP USER mysqltest_db1@localhost;
CREATE DATABASE test1;
CREATE DATABASE test2;
CREATE TABLE test1.t0 (a VARCHAR(20));
CREATE TABLE test2.t1 (a VARCHAR(20));
CREATE VIEW test2.t3 AS SELECT * FROM test1.t0;
CREATE OR REPLACE VIEW test.v1 AS
SELECT ta.a AS col1, tb.a AS col2 FROM test2.t3 ta, test2.t1 tb;
DROP VIEW test.v1;
DROP VIEW test2.t3;
DROP TABLE test2.t1, test1.t0;
DROP DATABASE test2;
DROP DATABASE test1;
......@@ -238,3 +238,12 @@ INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
DROP TABLE t1;
# End of 4.1 tests
#
# Bug #18080: INSERT ... SELECT ... JOIN results in ambiguous field list error
#
CREATE TABLE t1 (x int, y int);
CREATE TABLE t2 (z int, y int);
CREATE TABLE t3 (a int, b int);
INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1);
DROP TABLE IF EXISTS t1,t2,t3;
......@@ -325,6 +325,17 @@ alter table t1 add key (c1,c2,c1);
alter table t1 add key (c1,c1,c2);
drop table t1;
#
# Bug#11228: DESC shows arbitrary column as "PRI"
#
create table t1 (
i1 INT NOT NULL,
i2 INT NOT NULL,
UNIQUE i1idx (i1),
UNIQUE i2idx (i2));
desc t1;
drop table t1;
#
# Bug#12565 - ERROR 1034 when running simple UPDATE or DELETE
# on large MyISAM table
......
......@@ -852,3 +852,23 @@ DROP VIEW mysqltest_db1.view1;
DROP TABLE mysqltest_db1.t1;
DROP SCHEMA mysqltest_db1;
DROP USER mysqltest_db1@localhost;
#
# BUG#20482: failure on Create join view with sources views/tables
# in different schemas
#
--disable_warnings
CREATE DATABASE test1;
CREATE DATABASE test2;
--enable_warnings
CREATE TABLE test1.t0 (a VARCHAR(20));
CREATE TABLE test2.t1 (a VARCHAR(20));
CREATE VIEW test2.t3 AS SELECT * FROM test1.t0;
CREATE OR REPLACE VIEW test.v1 AS
SELECT ta.a AS col1, tb.a AS col2 FROM test2.t3 ta, test2.t1 tb;
DROP VIEW test.v1;
DROP VIEW test2.t3;
DROP TABLE test2.t1, test1.t0;
DROP DATABASE test2;
DROP DATABASE test1;
......@@ -532,6 +532,8 @@ void cleanup_items(Item *item);
class THD;
void close_thread_tables(THD *thd, bool locked=0, bool skip_derived=0);
bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables);
bool check_single_table_access(THD *thd, ulong privilege,
TABLE_LIST *tables);
bool check_routine_access(THD *thd,ulong want_access,char *db,char *name,
bool is_proc, bool no_errors);
bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table);
......
......@@ -5471,7 +5471,7 @@ bool setup_tables_and_check_access(THD *thd,
for (; leaves_tmp; leaves_tmp= leaves_tmp->next_leaf)
{
if (leaves_tmp->belong_to_view &&
check_one_table_access(thd, want_access, leaves_tmp))
check_single_table_access(thd, want_access, leaves_tmp))
{
tables->hide_view_error(thd);
return TRUE;
......
......@@ -1941,15 +1941,10 @@ bool select_dumpvar::send_data(List<Item> &items)
Item_func_set_user_var *xx;
Item_splocal *yy;
my_var *zz;
DBUG_ENTER("send_data");
if (unit->offset_limit_cnt)
{ // using limit offset,count
unit->offset_limit_cnt--;
DBUG_RETURN(0);
}
DBUG_ENTER("select_dumpvar::send_data");
if (unit->offset_limit_cnt)
{ // Using limit offset,count
{ // using limit offset,count
unit->offset_limit_cnt--;
DBUG_RETURN(0);
}
......
......@@ -3382,15 +3382,6 @@ mysql_execute_command(THD *thd)
&lex->value_list,
lex->duplicates, lex->ignore)))
{
/*
Skip first table, which is the table we are inserting in.
Below we set context.table_list again because the call above to
mysql_insert_select_prepare() calls resolve_in_table_list_only(),
which in turn resets context.table_list and
context.first_name_resolution_table.
*/
select_lex->context.table_list=
select_lex->context.first_name_resolution_table= second_table;
res= handle_select(thd, lex, result, OPTION_SETUP_TABLES_DONE);
/*
Invalidate the table in the query cache if something changed
......@@ -5249,11 +5240,10 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
/*
Check grants for commands which work only with one table and all other
tables belonging to subselects or implicitly opened tables.
Check grants for commands which work only with one table.
SYNOPSIS
check_one_table_access()
check_single_table_access()
thd Thread handler
privilege requested privilege
all_tables global table list of query
......@@ -5263,7 +5253,8 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
1 - access denied, error is sent to client
*/
bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
bool check_single_table_access(THD *thd, ulong privilege,
TABLE_LIST *all_tables)
{
Security_context * backup_ctx= thd->security_ctx;
......@@ -5288,19 +5279,41 @@ bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
goto deny;
thd->security_ctx= backup_ctx;
return 0;
deny:
thd->security_ctx= backup_ctx;
return 1;
}
/*
Check grants for commands which work only with one table and all other
tables belonging to subselects or implicitly opened tables.
SYNOPSIS
check_one_table_access()
thd Thread handler
privilege requested privilege
all_tables global table list of query
RETURN
0 - OK
1 - access denied, error is sent to client
*/
bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
{
if (check_single_table_access (thd,privilege,all_tables))
return 1;
/* Check rights on tables of subselects and implictly opened tables */
TABLE_LIST *subselects_tables;
if ((subselects_tables= all_tables->next_global))
{
if ((check_table_access(thd, SELECT_ACL, subselects_tables, 0)))
goto deny;
return 1;
}
return 0;
deny:
thd->security_ctx= backup_ctx;
return 1;
}
......
......@@ -1025,27 +1025,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (share->key_info[key].flags & HA_FULLTEXT)
share->key_info[key].algorithm= HA_KEY_ALG_FULLTEXT;
if (primary_key >= MAX_KEY && (keyinfo->flags & HA_NOSAME))
{
/*
If the UNIQUE key doesn't have NULL columns and is not a part key
declare this as a primary key.
*/
primary_key=key;
for (i=0 ; i < keyinfo->key_parts ;i++)
{
uint fieldnr= key_part[i].fieldnr;
if (!fieldnr ||
share->field[fieldnr-1]->null_ptr ||
share->field[fieldnr-1]->key_length() !=
key_part[i].length)
{
primary_key=MAX_KEY; // Can't be used
break;
}
}
}
for (i=0 ; i < keyinfo->key_parts ; key_part++,i++)
{
Field *field;
......
......@@ -67,12 +67,6 @@ conf_to_src_LDFLAGS= @NOINST_LDFLAGS@
#strtoull.o: @CHARSET_OBJS@
if ASSEMBLER
# On Linux gcc can compile the assembly files
%.o : %.s
$(AS) $(ASFLAGS) -o $@ $<
endif
FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
str_test: str_test.c $(pkglib_LIBRARIES)
......
......@@ -148,6 +148,19 @@ They should be used with caution.
%{see_base}
%package bench
Requires: %{name}-client perl-DBI perl
Summary: MySQL - Benchmarks and test system
Group: Applications/Databases
Provides: mysql-bench
Obsoletes: mysql-bench
AutoReqProv: no
%description bench
This package contains MySQL benchmark scripts and data.
%{see_base}
%package devel
Summary: MySQL - Development header files and libraries
Group: Applications/Databases
......
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