Commit e371b264 authored by unknown's avatar unknown
Browse files

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

into  eel.(none):/home/jonas/src/mysql-5.1-push

parents b1981d8f de82d9ee
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -2527,3 +2527,15 @@ SELECT * FROM t1;
id
1
DROP TABLE t2, t1;
CREATE TABLE t1
(
id INT PRIMARY KEY
) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2
(
id INT NOT NULL PRIMARY KEY,
b INT,
FOREIGN KEY (b) REFERENCES test.t1(id)
) ENGINE=InnoDB;
Got one of the listed errors
DROP TABLE t1;
+15 −0
Original line number Diff line number Diff line
@@ -1451,3 +1451,18 @@ TRUNCATE t1;
INSERT INTO t1 (id) VALUES (NULL);
SELECT * FROM t1;
DROP TABLE t2, t1;

-- Test that foreign keys in temporary tables are not accepted (bug #12084)
CREATE TABLE t1
(
 id INT PRIMARY KEY
) ENGINE=InnoDB;

--error 1005,1005
CREATE TEMPORARY TABLE t2
(
 id INT NOT NULL PRIMARY KEY,
 b INT,
 FOREIGN KEY (b) REFERENCES test.t1(id)
) ENGINE=InnoDB;
DROP TABLE t1;
+21 −40
Original line number Diff line number Diff line
@@ -4689,13 +4689,7 @@ ha_innobase::create(
		form->s->row_type != ROW_TYPE_REDUNDANT);

  	if (error) {
		innobase_commit_low(trx);

		row_mysql_unlock_data_dictionary(trx);

  		trx_free_for_mysql(trx);

 		DBUG_RETURN(error);
		goto cleanup;
 	}

	/* Look for a primary key */
@@ -4719,13 +4713,7 @@ ha_innobase::create(
		error = create_clustered_index_when_no_primary(trx,
							norm_name);
  		if (error) {
			innobase_commit_low(trx);

			row_mysql_unlock_data_dictionary(trx);

			trx_free_for_mysql(trx);

			DBUG_RETURN(error);
			goto cleanup;
      		}
	}

@@ -4734,13 +4722,7 @@ ha_innobase::create(
		first */
	    	if ((error = create_index(trx, form, norm_name,
					  (uint) primary_key_no))) {
			innobase_commit_low(trx);

			row_mysql_unlock_data_dictionary(trx);

  			trx_free_for_mysql(trx);

			DBUG_RETURN(error);
			goto cleanup;
      		}
      	}

@@ -4749,14 +4731,7 @@ ha_innobase::create(
		if (i != (uint) primary_key_no) {

    			if ((error = create_index(trx, form, norm_name, i))) {

			  	innobase_commit_low(trx);

				row_mysql_unlock_data_dictionary(trx);

  				trx_free_for_mysql(trx);

				DBUG_RETURN(error);
				goto cleanup;
      			}
      		}
  	}
@@ -4769,21 +4744,18 @@ ha_innobase::create(
					current_thd->query_length,
					current_thd->charset())) {
			error = HA_ERR_OUT_OF_MEM;
		} else {
			error = row_table_add_foreign_constraints(trx,
					q.str, norm_name);
			
			error = convert_error_code_to_mysql(error, NULL);
			goto cleanup;
		}

		if (error) {
			innobase_commit_low(trx);

			row_mysql_unlock_data_dictionary(trx);
		error = row_table_add_foreign_constraints(trx,
			q.str, norm_name,
			create_info->options & HA_LEX_CREATE_TMP_TABLE);

  			trx_free_for_mysql(trx);
		error = convert_error_code_to_mysql(error, NULL);

			DBUG_RETURN(error);
		if (error) {
			goto cleanup;
		}
	}

@@ -4823,6 +4795,15 @@ ha_innobase::create(
  	trx_free_for_mysql(trx);

	DBUG_RETURN(0);

cleanup:
	innobase_commit_low(trx);
	
	row_mysql_unlock_data_dictionary(trx);
	
	trx_free_for_mysql(trx);

	DBUG_RETURN(error);
}

/*********************************************************************
+1 −1
Original line number Diff line number Diff line
@@ -5495,7 +5495,7 @@ ER_COALESCE_ONLY_ON_HASH_PARTITION
        swe "COALESCE PARTITION kan bara anvndas p HASH/KEY partitioner"
ER_ONLY_ON_RANGE_LIST_PARTITION
        eng "%s PARTITION can only be used on RANGE/LIST partitions"
        eng "%s PARTITION kan bara anvndas p RANGE/LIST partitioner"
        swe "%s PARTITION kan bara anvndas p RANGE/LIST-partitioner"
ER_ADD_PARTITION_SUBPART_ERROR
        eng "Trying to Add partition(s) with wrong number of subpartitions"
        swe "ADD PARTITION med fel antal subpartitioner"
+1 −1
Original line number Diff line number Diff line
@@ -2686,11 +2686,11 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
  old_stmt_arena= thd->stmt_arena;
  thd->stmt_arena= this;
  lex_start(thd, (uchar*) thd->query, thd->query_length);
  lex->safe_to_cache_query= FALSE;
  lex->stmt_prepare_mode= TRUE;

  rc= yyparse((void *)thd) || thd->is_fatal_error ||
      thd->net.report_error || init_param_array(this);
  lex->safe_to_cache_query= FALSE;
  /*
    While doing context analysis of the query (in check_prepared_statement)
    we allocate a lot of additional memory: for open tables, JOINs, derived
Loading