merging from 5.0-bt rep to a local branch

This commit is contained in:
Andrei Elkin 2009-04-30 15:41:47 +03:00
commit 6b39bb5eac
39 changed files with 833 additions and 652 deletions

View file

@ -1101,12 +1101,20 @@ btr_search_drop_page_hash_when_freed(
page = buf_page_get_gen(space, page_no, RW_S_LATCH, NULL, page = buf_page_get_gen(space, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL, __FILE__, __LINE__, BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
&mtr); &mtr);
/* Because the buffer pool mutex was released by
buf_page_peek_if_search_hashed(), it is possible that the
block was removed from the buffer pool by another thread
before buf_page_get_gen() got a chance to acquire the buffer
pool mutex again. Thus, we must check for a NULL return. */
if (UNIV_LIKELY(page != NULL)) {
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_TREE_NODE_FROM_HASH); buf_page_dbg_add_level(page, SYNC_TREE_NODE_FROM_HASH);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
btr_search_drop_page_hash_index(page); btr_search_drop_page_hash_index(page);
}
mtr_commit(&mtr); mtr_commit(&mtr);
} }

View file

@ -253,6 +253,12 @@ extern ulint srv_read_ahead_seq;
/* variable to count the number of random read-aheads were done */ /* variable to count the number of random read-aheads were done */
extern ulint srv_read_ahead_rnd; extern ulint srv_read_ahead_rnd;
/* An option to enable the fix for "Bug#43660 SHOW INDEXES/ANALYZE does
NOT update cardinality for indexes of InnoDB table". By default we are
running with the fix disabled because MySQL 5.1 is frozen for such
behavioral changes. */
extern char srv_use_legacy_cardinality_algorithm;
/* In this structure we store status variables to be passed to MySQL */ /* In this structure we store status variables to be passed to MySQL */
typedef struct export_var_struct export_struc; typedef struct export_var_struct export_struc;

View file

@ -15,6 +15,8 @@ Created 10/4/1994 Heikki Tuuri
#include "mtr0log.h" #include "mtr0log.h"
#include "log0recv.h" #include "log0recv.h"
#include "rem0cmp.h" #include "rem0cmp.h"
#include "srv0srv.h"
#include "ut0ut.h"
static ulint page_rnd = 976722341; static ulint page_rnd = 976722341;
@ -23,6 +25,44 @@ static ulint page_rnd = 976722341;
ulint page_cur_short_succ = 0; ulint page_cur_short_succ = 0;
# endif /* UNIV_SEARCH_PERF_STAT */ # endif /* UNIV_SEARCH_PERF_STAT */
/***********************************************************************
This is a linear congruential generator PRNG. Returns a pseudo random
number between 0 and 2^64-1 inclusive. The formula and the constants
being used are:
X[n+1] = (a * X[n] + c) mod m
where:
X[0] = ut_usectime()
a = 1103515245 (3^5 * 5 * 7 * 129749)
c = 12345 (3 * 5 * 823)
m = 18446744073709551616 (2^64)
*/
#define LCG_a 1103515245
#define LCG_c 12345
static
unsigned long long
page_cur_lcg_prng()
/*===============*/
/* out: number between 0 and 2^64-1 */
{
static unsigned long long lcg_current = 0;
static ibool initialized = FALSE;
ulint time_sec;
ulint time_ms;
if (!initialized) {
ut_usectime(&time_sec, &time_ms);
lcg_current = (unsigned long long) (time_sec * 1000000
+ time_ms);
initialized = TRUE;
}
/* no need to "% 2^64" explicitly because lcg_current is
64 bit and this will be done anyway */
lcg_current = LCG_a * lcg_current + LCG_c;
return(lcg_current);
}
/******************************************************************** /********************************************************************
Tries a search shortcut based on the last insert. */ Tries a search shortcut based on the last insert. */
UNIV_INLINE UNIV_INLINE
@ -489,9 +529,13 @@ page_cur_open_on_rnd_user_rec(
return; return;
} }
page_rnd += 87584577; if (srv_use_legacy_cardinality_algorithm) {
page_rnd += 87584577;
rnd = page_rnd % page_get_n_recs(page); rnd = page_rnd % page_get_n_recs(page);
} else {
rnd = (ulint) page_cur_lcg_prng() % page_get_n_recs(page);
}
rec = page_get_infimum_rec(page); rec = page_get_infimum_rec(page);
@ -1419,3 +1463,30 @@ page_cur_delete_rec(
page_dir_balance_slot(page, cur_slot_no); page_dir_balance_slot(page, cur_slot_no);
} }
} }
#ifdef UNIV_COMPILE_TEST_FUNCS
/***********************************************************************
Print the first n numbers, generated by page_cur_lcg_prng() to make sure
(visually) that it works properly. */
void
test_page_cur_lcg_prng(
/*===================*/
int n) /* in: print first n numbers */
{
int i;
unsigned long long rnd;
for (i = 0; i < n; i++) {
rnd = page_cur_lcg_prng();
printf("%llu\t%%2=%llu %%3=%llu %%5=%llu %%7=%llu %%11=%llu\n",
rnd,
rnd % 2,
rnd % 3,
rnd % 5,
rnd % 7,
rnd % 11);
}
}
#endif /* UNIV_COMPILE_TEST_FUNCS */

View file

@ -239,6 +239,12 @@ ulint srv_read_ahead_seq = 0;
/* variable to count the number of random read-aheads */ /* variable to count the number of random read-aheads */
ulint srv_read_ahead_rnd = 0; ulint srv_read_ahead_rnd = 0;
/* An option to enable the fix for "Bug#43660 SHOW INDEXES/ANALYZE does
NOT update cardinality for indexes of InnoDB table". By default we are
running with the fix disabled because MySQL 5.1 is frozen for such
behavioral changes. */
char srv_use_legacy_cardinality_algorithm = TRUE;
/* structure to pass status variables to MySQL */ /* structure to pass status variables to MySQL */
export_struc export_vars; export_struc export_vars;

View file

@ -250,7 +250,11 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (info->ft1_to_ft2) if (info->ft1_to_ft2)
{ {
/* we're in ft1->ft2 conversion mode. Saving key data */ /* we're in ft1->ft2 conversion mode. Saving key data */
insert_dynamic(info->ft1_to_ft2, (char*) (lastkey+off)); if (insert_dynamic(info->ft1_to_ft2, (char*) (lastkey+off)))
{
DBUG_PRINT("error",("Out of memory"));
DBUG_RETURN(-1);
}
} }
else else
{ {

View file

@ -550,7 +550,14 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo,
we cannot easily dispatch an empty page here */ we cannot easily dispatch an empty page here */
b+=blen+ft2len+2; b+=blen+ft2len+2;
for (a=anc_buff+a_length ; b < a ; b+=ft2len+2) for (a=anc_buff+a_length ; b < a ; b+=ft2len+2)
insert_dynamic(info->ft1_to_ft2, (char*) b); {
if (insert_dynamic(info->ft1_to_ft2, (char*) b))
{
mi_print_error(info->s, HA_ERR_OUT_OF_MEM);
my_errno= HA_ERR_OUT_OF_MEM;
DBUG_RETURN(-1);
}
}
/* fixing the page's length - it contains only one key now */ /* fixing the page's length - it contains only one key now */
mi_putint(anc_buff,2+blen+ft2len+2,0); mi_putint(anc_buff,2+blen+ft2len+2,0);

View file

@ -186,106 +186,106 @@ CREATE TABLE t2 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL g GEOMETRY NOT NULL
) ENGINE=MyISAM; ) ENGINE=MyISAM;
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10)));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10)))); INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10)));
ALTER TABLE t2 ADD SPATIAL KEY(g); ALTER TABLE t2 ADD SPATIAL KEY(g);
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -309,406 +309,406 @@ fid AsText(g)
56 LINESTRING(41 41,50 50) 56 LINESTRING(41 41,50 50)
45 LINESTRING(51 51,60 60) 45 LINESTRING(51 51,60 60)
55 LINESTRING(41 51,50 60) 55 LINESTRING(41 51,50 60)
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
99 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
98 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
97 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
96 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
95 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
94 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
93 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
92 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
91 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
90 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
89 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
88 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
87 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
86 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
85 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
84 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
83 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
82 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
81 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
80 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
79 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
78 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
77 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
76 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
75 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
74 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
73 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
72 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
71 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
70 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
69 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
68 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
67 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
66 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
65 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
64 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
63 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
62 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
61 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
60 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
59 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
58 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
57 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
56 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
55 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
54 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
53 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
52 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
51 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
50 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
49 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
48 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
47 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
46 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
45 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
44 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
43 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
42 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
41 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
40 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
39 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
38 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
37 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
36 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
35 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
34 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
33 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
32 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
31 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
30 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
29 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
28 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
27 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
26 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
25 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
24 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
23 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
22 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
21 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
20 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
19 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
18 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
17 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
16 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
15 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
14 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
13 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
12 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
11 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
10 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
9 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
8 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
7 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
6 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
5 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
4 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
3 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
2 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
1 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
0 100
DROP TABLE t2; DROP TABLE t2;
drop table if exists t1; drop table if exists t1;
Warnings: Warnings:
@ -863,11 +863,11 @@ Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) ); CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,1))); INSERT INTO t1 (foo) VALUES (POINT(1,1));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,0))); INSERT INTO t1 (foo) VALUES (POINT(1,0));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,1))); INSERT INTO t1 (foo) VALUES (POINT(0,1));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,0))); INSERT INTO t1 (foo) VALUES (POINT(0,0));
SELECT 1 FROM t1 WHERE foo != PointFromWKB(POINT(0,0)); SELECT 1 FROM t1 WHERE foo != POINT(0,0);
1 1
1 1
1 1
@ -1426,35 +1426,35 @@ Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
DROP TABLE t1; DROP TABLE t1;
create table t1 (a geometry not null, spatial index(a)); create table t1 (a geometry not null, spatial index(a));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072))); insert into t1 values (POINT(1.1517219314031e+164, 131072));
insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284))); insert into t1 values (POINT(9.1248812352444e+192, 2.9740338169556e+284));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0))); insert into t1 values (POINT(4.7783097267365e-299, -0));
insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53))); insert into t1 values (POINT(1.49166814624e-154, 2.0880974297595e-53));
insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111))); insert into t1 values (POINT(4.0917382598702e+149, 1.2024538023802e+111));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241))); insert into t1 values (POINT(2.0349165139404e+236, 2.9993936277913e-241));
insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111))); insert into t1 values (POINT(2.5243548967072e-29, 1.2024538023802e+111));
insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251))); insert into t1 values (POINT(0, 6.9835074892995e-251));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231))); insert into t1 values (POINT(2.0880974297595e-53, 3.1050361846014e+231));
insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260))); insert into t1 values (POINT(2.8728483499323e-188, 2.4600631144627e+260));
insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236))); insert into t1 values (POINT(3.0517578125e-05, 2.0349165139404e+236));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125))); insert into t1 values (POINT(1.1517219314031e+164, 1.1818212630766e-125));
insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275))); insert into t1 values (POINT(2.481040258324e-265, 5.7766220027675e-275));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29))); insert into t1 values (POINT(2.0880974297595e-53, 2.5243548967072e-29));
insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86))); insert into t1 values (POINT(5.7766220027675e-275, 9.9464647281957e+86));
insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270))); insert into t1 values (POINT(2.2181357552967e+130, 3.7857669957337e-270));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19))); insert into t1 values (POINT(4.5767114681874e-246, 3.6893488147419e+19));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255))); insert into t1 values (POINT(4.5767114681874e-246, 3.7537584144024e+255));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130))); insert into t1 values (POINT(3.7857669957337e-270, 1.8033161362863e-130));
insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39))); insert into t1 values (POINT(0, 5.8774717541114e-39));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159))); insert into t1 values (POINT(1.1517219314031e+164, 2.2761049594727e-159));
insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270))); insert into t1 values (POINT(6.243497100632e+144, 3.7857669957337e-270));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82))); insert into t1 values (POINT(3.7857669957337e-270, 2.6355494858076e-82));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34))); insert into t1 values (POINT(2.0349165139404e+236, 3.8518598887745e-34));
insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53))); insert into t1 values (POINT(4.6566128730774e-10, 2.0880974297595e-53));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183))); insert into t1 values (POINT(2.0880974297595e-53, 1.8827498946116e-183));
insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192))); insert into t1 values (POINT(1.8033161362863e-130, 9.1248812352444e+192));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159))); insert into t1 values (POINT(4.7783097267365e-299, 2.2761049594727e-159));
insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178))); insert into t1 values (POINT(1.94906280228e+289, 1.2338789709327e-178));
drop table t1; drop table t1;
CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) ); CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
INSERT INTO t1(foo) VALUES (NULL); INSERT INTO t1(foo) VALUES (NULL);

View file

@ -47,26 +47,26 @@ INSERT INTO gis_point VALUES
INSERT INTO gis_line VALUES INSERT INTO gis_line VALUES
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')), (105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10)))); (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
INSERT INTO gis_polygon VALUES INSERT INTO gis_polygon VALUES
(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))); (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
INSERT INTO gis_multi_point VALUES INSERT INTO gis_multi_point VALUES
(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10)))); (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
INSERT INTO gis_multi_line VALUES INSERT INTO gis_multi_line VALUES
(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))); (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
INSERT INTO gis_multi_polygon VALUES INSERT INTO gis_multi_polygon VALUES
(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))); (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
INSERT INTO gis_geometrycollection VALUES INSERT INTO gis_geometrycollection VALUES
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))); (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))));
INSERT into gis_geometry SELECT * FROM gis_point; INSERT into gis_geometry SELECT * FROM gis_point;
INSERT into gis_geometry SELECT * FROM gis_line; INSERT into gis_geometry SELECT * FROM gis_line;
INSERT into gis_geometry SELECT * FROM gis_polygon; INSERT into gis_geometry SELECT * FROM gis_polygon;

View file

@ -1803,15 +1803,12 @@ Innodb_buffer_pool_pages_total 512
show status like "Innodb_page_size"; show status like "Innodb_page_size";
Variable_name Value Variable_name Value
Innodb_page_size 16384 Innodb_page_size 16384
show status like "Innodb_rows_deleted"; innodb_rows_deleted
Variable_name Value 73
Innodb_rows_deleted 73 innodb_rows_inserted
show status like "Innodb_rows_inserted"; 29734
Variable_name Value innodb_rows_updated
Innodb_rows_inserted 29734 29532
show status like "Innodb_rows_updated";
Variable_name Value
Innodb_rows_updated 29532
show status like "Innodb_row_lock_waits"; show status like "Innodb_row_lock_waits";
Variable_name Value Variable_name Value
Innodb_row_lock_waits 0 Innodb_row_lock_waits 0

View file

@ -393,6 +393,7 @@ id c1 cnt
1 0 3 1 0 3
2 2 1 2 2 1
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2;
create table t1(f1 int primary key, create table t1(f1 int primary key,
f2 timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP); f2 timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP);
insert into t1(f1) values(1); insert into t1(f1) values(1);

View file

@ -4,9 +4,4 @@ Id User Host db Command Time State Info
number root localhost test Query time NULL show full processlist number root localhost test Query time NULL show full processlist
deallocate prepare stmt1; deallocate prepare stmt1;
FLUSH STATUS; FLUSH STATUS;
SHOW GLOBAL STATUS LIKE 'com_select'; Value of com_select did not change
Variable_name Value
Com_select 101
SHOW GLOBAL STATUS LIKE 'com_select';
Variable_name Value
Com_select 101

View file

@ -4388,4 +4388,17 @@ f3 f4 count
1 abc 1 1 abc 1
1 def 2 1 def 2
drop table t1, t2, t3; drop table t1, t2, t3;
CREATE TABLE t1 (a INT KEY, b INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 1)) limit 2
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` > 1)) limit 2
DROP TABLE t1;
End of 5.0 tests End of 5.0 tests

View file

@ -1,3 +1,5 @@
drop function if exists bug23333|
drop table if exists t1,t2|
CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM| CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM|
CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB| CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
insert into t2 values (1,1)| insert into t2 values (1,1)|
@ -20,4 +22,5 @@ master-bin.000001 # Query 1 # #
select count(*),@a from t1 /* must be 1,1 */| select count(*),@a from t1 /* must be 1,1 */|
count(*) @a count(*) @a
1 1 1 1
drop table t1, t2| drop table t1,t2;
drop function if exists bug23333;

View file

@ -78,6 +78,7 @@ alter table t1 modify a varchar(255);
select length(a) from t1; select length(a) from t1;
length(a) length(a)
6 6
drop table t1;
select 0b01000001; select 0b01000001;
0b01000001 0b01000001
A A

View file

@ -86,6 +86,15 @@ let $check_std_csets= 1;
let $check_ucs2_csets= 1; let $check_ucs2_csets= 1;
let $check_utf8_csets= 1; let $check_utf8_csets= 1;
# Bug#32784: Timeout in test "innodb_charset": InnoDB much slower
# than other handlers
# NOTE: We turn autocommit off to improve the performance of the innodb variant
# of this test. Per Innobase's recommendation.
--disable_query_log
SET autocommit=0;
--enable_query_log
# #
# Check all charsets/collation combinations # Check all charsets/collation combinations
# #

View file

@ -41,7 +41,7 @@ while ($1)
let $2=10; let $2=10;
while ($2) while ($2)
{ {
eval INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10)))); eval INSERT INTO t2 (g) VALUES (LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10)));
dec $2; dec $2;
} }
dec $1; dec $1;
@ -61,7 +61,7 @@ while ($1)
let $2=10; let $2=10;
while ($2) while ($2)
{ {
eval DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10))))); eval DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
dec $2; dec $2;
} }
@ -235,11 +235,11 @@ DROP TABLE t1;
# Bug #21888: Query on GEOMETRY field using PointFromWKB() results in lost connection # Bug #21888: Query on GEOMETRY field using PointFromWKB() results in lost connection
# #
CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) ); CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,1))); INSERT INTO t1 (foo) VALUES (POINT(1,1));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,0))); INSERT INTO t1 (foo) VALUES (POINT(1,0));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,1))); INSERT INTO t1 (foo) VALUES (POINT(0,1));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,0))); INSERT INTO t1 (foo) VALUES (POINT(0,0));
SELECT 1 FROM t1 WHERE foo != PointFromWKB(POINT(0,0)); SELECT 1 FROM t1 WHERE foo != POINT(0,0);
DROP TABLE t1; DROP TABLE t1;
# #
@ -802,35 +802,35 @@ DROP TABLE t1;
# #
create table t1 (a geometry not null, spatial index(a)); create table t1 (a geometry not null, spatial index(a));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072))); insert into t1 values (POINT(1.1517219314031e+164, 131072));
insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284))); insert into t1 values (POINT(9.1248812352444e+192, 2.9740338169556e+284));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0))); insert into t1 values (POINT(4.7783097267365e-299, -0));
insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53))); insert into t1 values (POINT(1.49166814624e-154, 2.0880974297595e-53));
insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111))); insert into t1 values (POINT(4.0917382598702e+149, 1.2024538023802e+111));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241))); insert into t1 values (POINT(2.0349165139404e+236, 2.9993936277913e-241));
insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111))); insert into t1 values (POINT(2.5243548967072e-29, 1.2024538023802e+111));
insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251))); insert into t1 values (POINT(0, 6.9835074892995e-251));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231))); insert into t1 values (POINT(2.0880974297595e-53, 3.1050361846014e+231));
insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260))); insert into t1 values (POINT(2.8728483499323e-188, 2.4600631144627e+260));
insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236))); insert into t1 values (POINT(3.0517578125e-05, 2.0349165139404e+236));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125))); insert into t1 values (POINT(1.1517219314031e+164, 1.1818212630766e-125));
insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275))); insert into t1 values (POINT(2.481040258324e-265, 5.7766220027675e-275));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29))); insert into t1 values (POINT(2.0880974297595e-53, 2.5243548967072e-29));
insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86))); insert into t1 values (POINT(5.7766220027675e-275, 9.9464647281957e+86));
insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270))); insert into t1 values (POINT(2.2181357552967e+130, 3.7857669957337e-270));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19))); insert into t1 values (POINT(4.5767114681874e-246, 3.6893488147419e+19));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255))); insert into t1 values (POINT(4.5767114681874e-246, 3.7537584144024e+255));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130))); insert into t1 values (POINT(3.7857669957337e-270, 1.8033161362863e-130));
insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39))); insert into t1 values (POINT(0, 5.8774717541114e-39));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159))); insert into t1 values (POINT(1.1517219314031e+164, 2.2761049594727e-159));
insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270))); insert into t1 values (POINT(6.243497100632e+144, 3.7857669957337e-270));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82))); insert into t1 values (POINT(3.7857669957337e-270, 2.6355494858076e-82));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34))); insert into t1 values (POINT(2.0349165139404e+236, 3.8518598887745e-34));
insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53))); insert into t1 values (POINT(4.6566128730774e-10, 2.0880974297595e-53));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183))); insert into t1 values (POINT(2.0880974297595e-53, 1.8827498946116e-183));
insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192))); insert into t1 values (POINT(1.8033161362863e-130, 9.1248812352444e+192));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159))); insert into t1 values (POINT(4.7783097267365e-299, 2.2761049594727e-159));
insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178))); insert into t1 values (POINT(1.94906280228e+289, 1.2338789709327e-178));
drop table t1; drop table t1;
# End of 4.1 tests # End of 4.1 tests

View file

@ -36,32 +36,32 @@ INSERT INTO gis_point VALUES
INSERT INTO gis_line VALUES INSERT INTO gis_line VALUES
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')), (105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10)))); (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
INSERT INTO gis_polygon VALUES INSERT INTO gis_polygon VALUES
(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))); (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
INSERT INTO gis_multi_point VALUES INSERT INTO gis_multi_point VALUES
(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10)))); (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
INSERT INTO gis_multi_line VALUES INSERT INTO gis_multi_line VALUES
(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))); (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
INSERT INTO gis_multi_polygon VALUES INSERT INTO gis_multi_polygon VALUES
(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))); (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
INSERT INTO gis_geometrycollection VALUES INSERT INTO gis_geometrycollection VALUES
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))); (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))));
INSERT into gis_geometry SELECT * FROM gis_point; INSERT into gis_geometry SELECT * FROM gis_point;
INSERT into gis_geometry SELECT * FROM gis_line; INSERT into gis_geometry SELECT * FROM gis_line;

View file

@ -13,6 +13,18 @@
-- source include/have_innodb.inc -- source include/have_innodb.inc
# Save the original values of some variables in order to be able to
# estimate how much they have changed during the tests. Previously this
# test assumed that e.g. rows_deleted is 0 here and after deleting 23
# rows it expected that rows_deleted will be 23. Now we do not make
# assumptions about the values of the variables at the beginning, e.g.
# rows_deleted should be 23 + "rows_deleted before the test". This allows
# the test to be run multiple times without restarting the mysqld server.
# See Bug#43309 Test main.innodb can't be run twice
-- let $innodb_rows_deleted_orig = query_get_value(SHOW STATUS WHERE variable_name = 'innodb_rows_deleted', Value, 1)
-- let $innodb_rows_inserted_orig = query_get_value(SHOW STATUS WHERE variable_name = 'innodb_rows_inserted', Value, 1)
-- let $innodb_rows_updated_orig = query_get_value(SHOW STATUS WHERE variable_name = 'innodb_rows_updated', Value, 1)
# #
# Small basic test with ignore # Small basic test with ignore
# #
@ -1344,9 +1356,14 @@ drop table t1;
# uses previous ones(pages_created, rows_deleted, ...). # uses previous ones(pages_created, rows_deleted, ...).
show status like "Innodb_buffer_pool_pages_total"; show status like "Innodb_buffer_pool_pages_total";
show status like "Innodb_page_size"; show status like "Innodb_page_size";
show status like "Innodb_rows_deleted"; -- let $innodb_rows_deleted = query_get_value(SHOW STATUS WHERE variable_name = 'innodb_rows_deleted', Value, 1)
show status like "Innodb_rows_inserted"; -- let $innodb_rows_inserted = query_get_value(SHOW STATUS WHERE variable_name = 'innodb_rows_inserted', Value, 1)
show status like "Innodb_rows_updated"; -- let $innodb_rows_updated = query_get_value(SHOW STATUS WHERE variable_name = 'innodb_rows_updated', Value, 1)
-- disable_query_log
-- eval SELECT $innodb_rows_deleted - $innodb_rows_deleted_orig AS innodb_rows_deleted
-- eval SELECT $innodb_rows_inserted - $innodb_rows_inserted_orig AS innodb_rows_inserted
-- eval SELECT $innodb_rows_updated - $innodb_rows_updated_orig AS innodb_rows_updated
-- enable_query_log
# Test for row locks InnoDB status variables. # Test for row locks InnoDB status variables.
show status like "Innodb_row_lock_waits"; show status like "Innodb_row_lock_waits";
@ -1365,6 +1382,8 @@ set global innodb_sync_spin_loops=20;
show variables like "innodb_sync_spin_loops"; show variables like "innodb_sync_spin_loops";
# Test for innodb_thread_concurrency variable # Test for innodb_thread_concurrency variable
# save the original value so we can restore it at the end
-- let $innodb_thread_concurrency_orig = query_get_value(SHOW VARIABLES WHERE variable_name = 'innodb_thread_concurrency', Value, 1)
show variables like "innodb_thread_concurrency"; show variables like "innodb_thread_concurrency";
set global innodb_thread_concurrency=1001; set global innodb_thread_concurrency=1001;
show variables like "innodb_thread_concurrency"; show variables like "innodb_thread_concurrency";
@ -1372,6 +1391,10 @@ set global innodb_thread_concurrency=0;
show variables like "innodb_thread_concurrency"; show variables like "innodb_thread_concurrency";
set global innodb_thread_concurrency=16; set global innodb_thread_concurrency=16;
show variables like "innodb_thread_concurrency"; show variables like "innodb_thread_concurrency";
# restore the orginal value, this way the test can be run multiple times
-- disable_query_log
-- eval set global innodb_thread_concurrency = $innodb_thread_concurrency_orig
-- enable_query_log
# Test for innodb_concurrency_tickets variable # Test for innodb_concurrency_tickets variable
show variables like "innodb_concurrency_tickets"; show variables like "innodb_concurrency_tickets";

View file

@ -12,7 +12,7 @@ INSERT t1 VALUES (8,4,50) ON DUPLICATE KEY UPDATE c=c+1000;
SELECT * FROM t1; SELECT * FROM t1;
INSERT t1 VALUES (1,4,60) ON DUPLICATE KEY UPDATE c=c+10000; INSERT t1 VALUES (1,4,60) ON DUPLICATE KEY UPDATE c=c+10000;
SELECT * FROM t1; SELECT * FROM t1;
-- error 1062 -- error ER_DUP_ENTRY
INSERT t1 VALUES (1,9,70) ON DUPLICATE KEY UPDATE c=c+100000, b=4; INSERT t1 VALUES (1,9,70) ON DUPLICATE KEY UPDATE c=c+100000, b=4;
SELECT * FROM t1; SELECT * FROM t1;
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
@ -63,7 +63,7 @@ INSERT t1 SELECT 8,4,50 FROM DUAL ON DUPLICATE KEY UPDATE c=c+1000;
SELECT * FROM t1; SELECT * FROM t1;
INSERT t1 SELECT 1,4,60 FROM DUAL ON DUPLICATE KEY UPDATE c=c+10000; INSERT t1 SELECT 1,4,60 FROM DUAL ON DUPLICATE KEY UPDATE c=c+10000;
SELECT * FROM t1; SELECT * FROM t1;
-- error 1062 -- error ER_DUP_ENTRY
INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4; INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4;
SELECT * FROM t1; SELECT * FROM t1;
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
@ -76,7 +76,7 @@ INSERT t1 SELECT a,b,c FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=t1.c+100;
SELECT * FROM t1; SELECT * FROM t1;
INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0; INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
SELECT * FROM t1; SELECT * FROM t1;
--error 1052 --error ER_NON_UNIQ_ERROR
INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a); INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=t1.c+VALUES(t1.a); INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=t1.c+VALUES(t1.a);
SELECT *, VALUES(a) FROM t1; SELECT *, VALUES(a) FROM t1;
@ -95,9 +95,9 @@ insert ignore into t1 select a from t1 as t2 on duplicate key update a=t1.a+1 ;
select * from t1; select * from t1;
insert into t1 select 1 on duplicate key update a=2; insert into t1 select 1 on duplicate key update a=2;
select * from t1; select * from t1;
--error 1052 --error ER_NON_UNIQ_ERROR
insert into t1 select a from t1 on duplicate key update a=a+1 ; insert into t1 select a from t1 on duplicate key update a=a+1 ;
--error 1052 --error ER_NON_UNIQ_ERROR
insert ignore into t1 select a from t1 on duplicate key update a=t1.a+1 ; insert ignore into t1 select a from t1 on duplicate key update a=t1.a+1 ;
drop table t1; drop table t1;
@ -171,13 +171,13 @@ SET SQL_MODE = 'TRADITIONAL';
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL); CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL);
--error 1364 --error ER_NO_DEFAULT_FOR_FIELD
INSERT INTO t1 (a) VALUES (1); INSERT INTO t1 (a) VALUES (1);
--error 1364 --error ER_NO_DEFAULT_FOR_FIELD
INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE a = b; INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE a = b;
--error 1364 --error ER_NO_DEFAULT_FOR_FIELD
INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE b = b; INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE b = b;
SELECT * FROM t1; SELECT * FROM t1;
@ -278,7 +278,7 @@ INSERT INTO t1 (id,c1) VALUES (1,10);
SELECT * FROM t1; SELECT * FROM t1;
CREATE TABLE t2 (id INT, c1 INT); CREATE TABLE t2 (id INT, c1 INT);
INSERT INTO t2 VALUES (1,NULL), (2,2); INSERT INTO t2 VALUES (1,NULL), (2,2);
--error 1048 --error ER_BAD_NULL_ERROR
INSERT INTO t1 (id,c1) SELECT 1,NULL INSERT INTO t1 (id,c1) SELECT 1,NULL
ON DUPLICATE KEY UPDATE c1=NULL; ON DUPLICATE KEY UPDATE c1=NULL;
SELECT * FROM t1; SELECT * FROM t1;
@ -290,6 +290,7 @@ INSERT IGNORE INTO t1 (id,c1) SELECT * FROM t2
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2;
# #
# Bug#28904: INSERT .. ON DUPLICATE was silently updating rows when it # Bug#28904: INSERT .. ON DUPLICATE was silently updating rows when it

View file

@ -39,8 +39,14 @@ while ($i)
--enable_query_log --enable_query_log
--enable_result_log --enable_result_log
SHOW GLOBAL STATUS LIKE 'com_select'; let $before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_select',Value,1);
--change_user --change_user
SHOW GLOBAL STATUS LIKE 'com_select'; let $after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_select',Value,1);
if (`select $after != $before`){
SHOW GLOBAL STATUS LIKE 'com_select';
die The value of com_select changed during change_user;
}
echo Value of com_select did not change;

View file

@ -3737,4 +3737,18 @@ cr.f4 = cr2.f4
GROUP BY a.f3, cr.f4; GROUP BY a.f3, cr.f4;
drop table t1, t2, t3; drop table t1, t2, t3;
#
# Bug #40925: Equality propagation takes non indexed attribute
#
CREATE TABLE t1 (a INT KEY, b INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2;
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2;
DROP TABLE t1;
--echo End of 5.0 tests --echo End of 5.0 tests

View file

@ -4,11 +4,15 @@
delimiter |; delimiter |;
# #
# Bug #13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog # Bug#13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog
# Bug #23333 stored function + non-transac table + transac table = # Bug#23333 stored function + non-transac table + transac table =
# breaks stmt-based binlog # breaks stmt-based binlog
# Bug #27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF() # Bug#27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF()
# #
--disable_warnings
drop function if exists bug23333|
drop table if exists t1,t2|
--enable_warnings
CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM| CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM|
CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB| CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
@ -29,5 +33,10 @@ insert into t2 values (bug23333(),1)|
--replace_column 2 # 5 # 6 # --replace_column 2 # 5 # 6 #
show binlog events from 98 /* with fixes for #23333 will show there are 2 queries */| show binlog events from 98 /* with fixes for #23333 will show there are 2 queries */|
select count(*),@a from t1 /* must be 1,1 */| select count(*),@a from t1 /* must be 1,1 */|
drop table t1, t2|
delimiter ;|
# clean-up
drop table t1,t2;
drop function if exists bug23333;

View file

@ -83,6 +83,7 @@ insert into t1 values("aaa ");
select length(a) from t1; select length(a) from t1;
alter table t1 modify a varchar(255); alter table t1 modify a varchar(255);
select length(a) from t1; select length(a) from t1;
drop table t1;
# #
# Bug#35658 (An empty binary value leads to mysqld crash) # Bug#35658 (An empty binary value leads to mysqld crash)

View file

@ -49,11 +49,11 @@ $0 Ver $VERSION
Usage: $0 db_name[./table_regex/] [new_db_name | directory] Usage: $0 db_name[./table_regex/] [new_db_name | directory]
-?, --help display this helpscreen and exit -?, --help display this help-screen and exit
-u, --user=# user for database login if not current user -u, --user=# user for database login if not current user
-p, --password=# password to use when connecting to server (if not set -p, --password=# password to use when connecting to server (if not set
in my.cnf, which is recommended) in my.cnf, which is recommended)
-h, --host=# Hostname for local server when connecting over TCP/IP -h, --host=# hostname for local server when connecting over TCP/IP
-P, --port=# port to use when connecting to local server with TCP/IP -P, --port=# port to use when connecting to local server with TCP/IP
-S, --socket=# socket to use when connecting to local server -S, --socket=# socket to use when connecting to local server
@ -86,7 +86,7 @@ sub usage {
# Do not initialize user or password options; that way, any user/password # Do not initialize user or password options; that way, any user/password
# options specified in option files will be used. If no values are specified # options specified in option files will be used. If no values are specified
# all, the defaults will be used (login name, no password). # at all, the defaults will be used (login name, no password).
my %opt = ( my %opt = (
noindices => 0, noindices => 0,
@ -95,7 +95,7 @@ my %opt = (
method => "cp", method => "cp",
flushlog => 0, flushlog => 0,
); );
Getopt::Long::Configure(qw(no_ignore_case)); # disambuguate -p and -P Getopt::Long::Configure(qw(no_ignore_case)); # disambiguate -p and -P
GetOptions( \%opt, GetOptions( \%opt,
"help", "help",
"host|h=s", "host|h=s",
@ -453,7 +453,7 @@ else {
printf "Locked $num_tables tables in %d seconds.\n", time-$start unless $opt{quiet}; printf "Locked $num_tables tables in %d seconds.\n", time-$start unless $opt{quiet};
$hc_started = time; # count from time lock is granted $hc_started = time; # count from time lock is granted
# flush tables to make on-disk copy uptodate # flush tables to make on-disk copy up to date
$start = time; $start = time;
$dbh->do("FLUSH TABLES /*!32323 $hc_tables */"); $dbh->do("FLUSH TABLES /*!32323 $hc_tables */");
printf "Flushed tables ($hc_tables) in %d seconds.\n", time-$start unless $opt{quiet}; printf "Flushed tables ($hc_tables) in %d seconds.\n", time-$start unless $opt{quiet};
@ -895,7 +895,7 @@ tables and you don't want to have all the tables locked for the
whole duration. whole duration.
In this situation, I<if> you are happy for groups of tables to be In this situation, I<if> you are happy for groups of tables to be
backed up separately (and thus possibly not be logically consistant backed up separately (and thus possibly not be logically consistent
with one another) then you can run mysqlhotcopy several times on with one another) then you can run mysqlhotcopy several times on
the same database each with different db_name./table_regex/. the same database each with different db_name./table_regex/.
All but the first should use the --addtodest option so the tables All but the first should use the --addtodest option so the tables
@ -920,7 +920,7 @@ server in a mutual replication setup.
=item --regexp pattern =item --regexp pattern
Copy all databases with names matching the pattern Copy all databases with names matching the pattern.
=item --regexp /pattern1/./pattern2/ =item --regexp /pattern1/./pattern2/
@ -933,7 +933,7 @@ names begin with 'bar' from all databases which names end with 'foo':
=item db_name./pattern/ =item db_name./pattern/
Copy only tables matching pattern. Shell metacharacters ( (, ), |, !, Copy only tables matching pattern. Shell metacharacters ( (, ), |, !,
etc.) have to be escaped (e.g. \). For example, to select all tables etc.) have to be escaped (e.g., \). For example, to select all tables
in database db1 whose names begin with 'foo' or 'bar': in database db1 whose names begin with 'foo' or 'bar':
mysqlhotcopy --indices --method=cp db1./^\(foo\|bar\)/ mysqlhotcopy --indices --method=cp db1./^\(foo\|bar\)/
@ -947,19 +947,19 @@ that do not begin with foo nor bar:
=item -?, --help =item -?, --help
Display helpscreen and exit Display help-screen and exit.
=item -u, --user=# =item -u, --user=#
user for database login if not current user User for database login if not current user.
=item -p, --password=# =item -p, --password=#
password to use when connecting to the server. Note that you are strongly Password to use when connecting to the server. Note that you are strongly
encouraged *not* to use this option as every user would be able to see the encouraged *not* to use this option as every user would be able to see the
password in the process list. Instead use the '[mysqlhotcopy]' section in password in the process list. Instead use the '[mysqlhotcopy]' section in
one of the config files, normally /etc/my.cnf or your personal ~/.my.cnf. one of the config files, normally /etc/my.cnf or your personal ~/.my.cnf.
(See the chapter 'my.cnf Option Files' in the manual) (See the chapter 'my.cnf Option Files' in the manual.)
=item -h, -h, --host=# =item -h, -h, --host=#
@ -968,12 +968,12 @@ different from 'localhost' will trigger mysqlhotcopy to use TCP/IP connection.
=item -P, --port=# =item -P, --port=#
port to use when connecting to MySQL server with TCP/IP. This is only used Port to use when connecting to MySQL server with TCP/IP. This is only used
when using the --host option. when using the --host option.
=item -S, --socket=# =item -S, --socket=#
UNIX domain socket to use when connecting to local server UNIX domain socket to use when connecting to local server.
=item --noindices =item --noindices
@ -983,7 +983,7 @@ on the backup.
=item --method=# =item --method=#
method for copy (only "cp" currently supported). Alpha support for Method for copy (only "cp" currently supported). Alpha support for
"scp" was added in November 2000. Your experience with the scp method "scp" was added in November 2000. Your experience with the scp method
will vary with your ability to understand how scp works. 'man scp' will vary with your ability to understand how scp works. 'man scp'
and 'man ssh' are your friends. and 'man ssh' are your friends.
@ -1000,15 +1000,15 @@ scp or rsync the files at your leisure.
=item -q, --quiet =item -q, --quiet
be silent except for errors Be silent except for errors.
=item --debug =item --debug
Debug messages are displayed Debug messages are displayed.
=item -n, --dryrun =item -n, --dryrun
Display commands without actually doing them Display commands without actually doing them.
=back =back
@ -1030,18 +1030,18 @@ to be specified on the command line:
mysqlhotcopy db newdb t1 t2 /^foo_/ : t3 /^bar_/ : + mysqlhotcopy db newdb t1 t2 /^foo_/ : t3 /^bar_/ : +
where ":" delimits the subsets, the /^foo_/ indicates all tables where ":" delimits the subsets, the /^foo_/ indicates all tables
with names begining with "foo_" and the "+" indicates all tables with names beginning with "foo_" and the "+" indicates all tables
not copied by the previous subsets. not copied by the previous subsets.
newdb is either another not existing database or a full path to a directory 'newdb' is either the name of the new database, or the full path name
where we can create a directory 'db' of the new database file. The database should not already exist.
Add option to lock each table in turn for people who don\'t need Add option to lock each table in turn for people who don\'t need
cross-table integrity. cross-table integrity.
Add option to FLUSH STATUS just before UNLOCK TABLES. Add option to FLUSH STATUS just before UNLOCK TABLES.
Add support for other copy methods (eg tar to single file?). Add support for other copy methods (e.g., tar to single file?).
Add support for forthcoming MySQL ``RAID'' table subdirectory layouts. Add support for forthcoming MySQL ``RAID'' table subdirectory layouts.
@ -1049,26 +1049,26 @@ Add support for forthcoming MySQL ``RAID'' table subdirectory layouts.
Tim Bunce Tim Bunce
Martin Waite - added checkpoint, flushlog, regexp and dryrun options Martin Waite - Added checkpoint, flushlog, regexp and dryrun options.
Fixed cleanup of targets when hotcopy fails. Fixed cleanup of targets when hotcopy fails.
Added --record_log_pos. Added --record_log_pos.
RAID tables are now copied (don't know if this works over scp). RAID tables are now copied (don't know if this works over scp).
Ralph Corderoy - added synonyms for commands Ralph Corderoy - Added synonyms for commands.
Scott Wiersdorf - added table regex and scp support Scott Wiersdorf - Added table regex and scp support.
Monty - working --noindex (copy only first 2048 bytes of index file) Monty - Working --noindex (copy only first 2048 bytes of index file).
Fixes for --method=scp Fixes for --method=scp.
Ask Bjoern Hansen - Cleanup code to fix a few bugs and enable -w again. Ask Bjoern Hansen - Cleanup code to fix a few bugs and enable -w again.
Emil S. Hansen - Added resetslave and resetmaster. Emil S. Hansen - Added resetslave and resetmaster.
Jeremy D. Zawodny - Removed depricated DBI calls. Fixed bug which Jeremy D. Zawodny - Removed deprecated DBI calls. Fixed bug which
resulted in nothing being copied when a regexp was specified but no resulted in nothing being copied when a regexp was specified but no
database name(s). database name(s).
Martin Waite - Fix to handle database name that contains space. Martin Waite - Fix to handle database name that contains space.
Paul DuBois - Remove end '/' from directory names Paul DuBois - Remove end '/' from directory names.

View file

@ -522,8 +522,7 @@ int Instance_options::add_option(const char* option)
switch (selected_options->type) { switch (selected_options->type) {
case SAVE_WHOLE_AND_ADD: case SAVE_WHOLE_AND_ADD:
*(selected_options->value)= tmp; *(selected_options->value)= tmp;
insert_dynamic(&options_array,(gptr) &tmp); return insert_dynamic(&options_array,(gptr) &tmp);
return 0;
case SAVE_VALUE: case SAVE_VALUE:
*(selected_options->value)= strchr(tmp, '=') + 1; *(selected_options->value)= strchr(tmp, '=') + 1;
return 0; return 0;

View file

@ -234,6 +234,11 @@ extern ulong srv_thread_sleep_delay;
extern ulong srv_thread_concurrency; extern ulong srv_thread_concurrency;
extern ulong srv_commit_concurrency; extern ulong srv_commit_concurrency;
extern ulong srv_flush_log_at_trx_commit; extern ulong srv_flush_log_at_trx_commit;
/* An option to enable the fix for "Bug#43660 SHOW INDEXES/ANALYZE does
NOT update cardinality for indexes of InnoDB table". By default we are
running with the fix disabled because MySQL 5.1 is frozen for such
behavioral changes. */
extern char srv_use_legacy_cardinality_algorithm;
} }
bool innobase_init(void); bool innobase_init(void);

View file

@ -4341,7 +4341,7 @@ Item *Item_field::replace_equal_field(byte *arg)
return const_item; return const_item;
} }
Item_field *subst= item_equal->get_first(); Item_field *subst= item_equal->get_first();
if (subst && !field->eq(subst->field)) if (subst && field->table != subst->field->table && !field->eq(subst->field))
return subst; return subst;
} }
return this; return this;

View file

@ -70,10 +70,17 @@ String *Item_func_geometry_from_wkb::val_str(String *str)
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
String arg_val; String arg_val;
String *wkb= args[0]->val_str(&arg_val); String *wkb;
Geometry_buffer buffer; Geometry_buffer buffer;
uint32 srid= 0; uint32 srid= 0;
if (args[0]->field_type() == MYSQL_TYPE_GEOMETRY)
{
return args[0]->val_str(str);
}
wkb= args[0]->val_str(&arg_val);
if ((arg_count == 2) && !args[1]->null_value) if ((arg_count == 2) && !args[1]->null_value)
srid= (uint32)args[1]->val_int(); srid= (uint32)args[1]->val_int();
@ -83,8 +90,8 @@ String *Item_func_geometry_from_wkb::val_str(String *str)
str->length(0); str->length(0);
str->q_append(srid); str->q_append(srid);
if ((null_value= if ((null_value=
(args[0]->null_value || (args[0]->null_value ||
!Geometry::create_from_wkb(&buffer, wkb->ptr(), wkb->length(), str)))) !Geometry::create_from_wkb(&buffer, wkb->ptr(), wkb->length(), str))))
return 0; return 0;
return str; return str;
} }
@ -337,14 +344,16 @@ String *Item_func_point::val_str(String *str)
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
double x= args[0]->val_real(); double x= args[0]->val_real();
double y= args[1]->val_real(); double y= args[1]->val_real();
uint32 srid= 0;
if ((null_value= (args[0]->null_value || if ((null_value= (args[0]->null_value ||
args[1]->null_value || args[1]->null_value ||
str->realloc(1 + 4 + SIZEOF_STORED_DOUBLE*2)))) str->realloc(4/*SRID*/ + 1 + 4 + SIZEOF_STORED_DOUBLE*2))))
return 0; return 0;
str->set_charset(&my_charset_bin); str->set_charset(&my_charset_bin);
str->length(0); str->length(0);
str->q_append(srid);
str->q_append((char)Geometry::wkb_ndr); str->q_append((char)Geometry::wkb_ndr);
str->q_append((uint32)Geometry::wkb_point); str->q_append((uint32)Geometry::wkb_point);
str->q_append(x); str->q_append(x);
@ -368,12 +377,14 @@ String *Item_func_spatial_collection::val_str(String *str)
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
String arg_value; String arg_value;
uint i; uint i;
uint32 srid= 0;
str->set_charset(&my_charset_bin); str->set_charset(&my_charset_bin);
str->length(0); str->length(0);
if (str->reserve(1 + 4 + 4, 512)) if (str->reserve(4/*SRID*/ + 1 + 4 + 4, 512))
goto err; goto err;
str->q_append(srid);
str->q_append((char) Geometry::wkb_ndr); str->q_append((char) Geometry::wkb_ndr);
str->q_append((uint32) coll_type); str->q_append((uint32) coll_type);
str->q_append((uint32) arg_count); str->q_append((uint32) arg_count);
@ -391,13 +402,13 @@ String *Item_func_spatial_collection::val_str(String *str)
In the case of GeometryCollection we don't need any checkings In the case of GeometryCollection we don't need any checkings
for item types, so just copy them into target collection for item types, so just copy them into target collection
*/ */
if (str->append(res->ptr(), len, (uint32) 512)) if (str->append(res->ptr() + 4/*SRID*/, len - 4/*SRID*/, (uint32) 512))
goto err; goto err;
} }
else else
{ {
enum Geometry::wkbType wkb_type; enum Geometry::wkbType wkb_type;
const char *data= res->ptr() + 1; const char *data= res->ptr() + 4/*SRID*/ + 1;
/* /*
In the case of named collection we must check that items In the case of named collection we must check that items
@ -406,7 +417,7 @@ String *Item_func_spatial_collection::val_str(String *str)
wkb_type= (Geometry::wkbType) uint4korr(data); wkb_type= (Geometry::wkbType) uint4korr(data);
data+= 4; data+= 4;
len-= 5; len-= 5 + 4/*SRID*/;
if (wkb_type != item_type) if (wkb_type != item_type)
goto err; goto err;

View file

@ -5044,7 +5044,8 @@ enum options_mysqld
OPT_SECURE_FILE_PRIV, OPT_SECURE_FILE_PRIV,
OPT_KEEP_FILES_ON_CREATE, OPT_KEEP_FILES_ON_CREATE,
OPT_INNODB_ADAPTIVE_HASH_INDEX, OPT_INNODB_ADAPTIVE_HASH_INDEX,
OPT_FEDERATED OPT_FEDERATED,
OPT_INNODB_USE_LEGACY_CARDINALITY_ALGORITHM
}; };
@ -5351,6 +5352,14 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
(gptr*) &global_system_variables.innodb_table_locks, (gptr*) &global_system_variables.innodb_table_locks,
(gptr*) &global_system_variables.innodb_table_locks, (gptr*) &global_system_variables.innodb_table_locks,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"innodb_use_legacy_cardinality_algorithm",
OPT_INNODB_USE_LEGACY_CARDINALITY_ALGORITHM,
"Use legacy algorithm for picking random pages during index cardinality "
"estimation. Disable this to use a better algorithm, but note that your "
"query plans may change (enabled by default).",
(gptr*) &srv_use_legacy_cardinality_algorithm,
(gptr*) &srv_use_legacy_cardinality_algorithm,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
#endif /* End HAVE_INNOBASE_DB */ #endif /* End HAVE_INNOBASE_DB */
{"isam", OPT_ISAM, "Obsolete. ISAM storage engine is no longer supported.", {"isam", OPT_ISAM, "Obsolete. ISAM storage engine is no longer supported.",
(gptr*) &opt_isam, (gptr*) &opt_isam, 0, GET_BOOL, NO_ARG, 0, 0, 0, (gptr*) &opt_isam, (gptr*) &opt_isam, 0, GET_BOOL, NO_ARG, 0, 0, 0,

View file

@ -450,6 +450,9 @@ sys_var_thd_bool sys_innodb_table_locks("innodb_table_locks",
&SV::innodb_table_locks); &SV::innodb_table_locks);
sys_var_thd_bool sys_innodb_support_xa("innodb_support_xa", sys_var_thd_bool sys_innodb_support_xa("innodb_support_xa",
&SV::innodb_support_xa); &SV::innodb_support_xa);
sys_var_bool_ptr sys_innodb_use_legacy_cardinality_algorithm(
"innodb_use_legacy_cardinality_algorithm",
&srv_use_legacy_cardinality_algorithm);
sys_var_long_ptr sys_innodb_autoextend_increment("innodb_autoextend_increment", sys_var_long_ptr sys_innodb_autoextend_increment("innodb_autoextend_increment",
&srv_auto_extend_increment); &srv_auto_extend_increment);
sys_var_long_ptr sys_innodb_sync_spin_loops("innodb_sync_spin_loops", sys_var_long_ptr sys_innodb_sync_spin_loops("innodb_sync_spin_loops",
@ -804,6 +807,7 @@ sys_var *sys_variables[]=
&sys_innodb_max_purge_lag, &sys_innodb_max_purge_lag,
&sys_innodb_table_locks, &sys_innodb_table_locks,
&sys_innodb_support_xa, &sys_innodb_support_xa,
&sys_innodb_use_legacy_cardinality_algorithm,
&sys_innodb_autoextend_increment, &sys_innodb_autoextend_increment,
&sys_innodb_sync_spin_loops, &sys_innodb_sync_spin_loops,
&sys_innodb_concurrency_tickets, &sys_innodb_concurrency_tickets,
@ -946,6 +950,8 @@ struct show_var_st init_vars[]= {
{sys_innodb_table_locks.name, (char*) &sys_innodb_table_locks, SHOW_SYS}, {sys_innodb_table_locks.name, (char*) &sys_innodb_table_locks, SHOW_SYS},
{sys_innodb_thread_concurrency.name, (char*) &sys_innodb_thread_concurrency, SHOW_SYS}, {sys_innodb_thread_concurrency.name, (char*) &sys_innodb_thread_concurrency, SHOW_SYS},
{sys_innodb_thread_sleep_delay.name, (char*) &sys_innodb_thread_sleep_delay, SHOW_SYS}, {sys_innodb_thread_sleep_delay.name, (char*) &sys_innodb_thread_sleep_delay, SHOW_SYS},
{sys_innodb_use_legacy_cardinality_algorithm.name,
(char*) &sys_innodb_use_legacy_cardinality_algorithm, SHOW_SYS},
#endif #endif
{sys_interactive_timeout.name,(char*) &sys_interactive_timeout, SHOW_SYS}, {sys_interactive_timeout.name,(char*) &sys_interactive_timeout, SHOW_SYS},
{sys_join_buffer_size.name, (char*) &sys_join_buffer_size, SHOW_SYS}, {sys_join_buffer_size.name, (char*) &sys_join_buffer_size, SHOW_SYS},

View file

@ -1104,8 +1104,7 @@ int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec)
e->tbl_name = e->db + (dot - table_spec) + 1; e->tbl_name = e->db + (dot - table_spec) + 1;
e->key_len = len; e->key_len = len;
memcpy(e->db, table_spec, len); memcpy(e->db, table_spec, len);
insert_dynamic(a, (gptr)&e); return insert_dynamic(a, (gptr)&e);
return 0;
} }

View file

@ -1929,17 +1929,16 @@ sp_head::restore_lex(THD *thd)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
void int
sp_head::push_backpatch(sp_instr *i, sp_label_t *lab) sp_head::push_backpatch(sp_instr *i, sp_label_t *lab)
{ {
bp_t *bp= (bp_t *)sql_alloc(sizeof(bp_t)); bp_t *bp= (bp_t *)sql_alloc(sizeof(bp_t));
if (bp) if (!bp)
{ return 1;
bp->lab= lab; bp->lab= lab;
bp->instr= i; bp->instr= i;
(void)m_backpatch.push_front(bp); return m_backpatch.push_front(bp);
}
} }
void void
@ -2014,7 +2013,7 @@ sp_head::fill_field_definition(THD *thd, LEX *lex,
} }
void int
sp_head::new_cont_backpatch(sp_instr_opt_meta *i) sp_head::new_cont_backpatch(sp_instr_opt_meta *i)
{ {
m_cont_level+= 1; m_cont_level+= 1;
@ -2022,15 +2021,17 @@ sp_head::new_cont_backpatch(sp_instr_opt_meta *i)
{ {
/* Use the cont. destination slot to store the level */ /* Use the cont. destination slot to store the level */
i->m_cont_dest= m_cont_level; i->m_cont_dest= m_cont_level;
(void)m_cont_backpatch.push_front(i); if (m_cont_backpatch.push_front(i))
return 1;
} }
return 0;
} }
void int
sp_head::add_cont_backpatch(sp_instr_opt_meta *i) sp_head::add_cont_backpatch(sp_instr_opt_meta *i)
{ {
i->m_cont_dest= m_cont_level; i->m_cont_dest= m_cont_level;
(void)m_cont_backpatch.push_front(i); return m_cont_backpatch.push_front(i);
} }
void void
@ -2212,7 +2213,7 @@ sp_head::show_create_procedure(THD *thd)
instr Instruction instr Instruction
*/ */
void sp_head::add_instr(sp_instr *instr) int sp_head::add_instr(sp_instr *instr)
{ {
instr->free_list= m_thd->free_list; instr->free_list= m_thd->free_list;
m_thd->free_list= 0; m_thd->free_list= 0;
@ -2223,7 +2224,7 @@ void sp_head::add_instr(sp_instr *instr)
entire stored procedure, as their life span is equal. entire stored procedure, as their life span is equal.
*/ */
instr->mem_root= &main_mem_root; instr->mem_root= &main_mem_root;
insert_dynamic(&m_instr, (gptr)&instr); return insert_dynamic(&m_instr, (gptr)&instr);
} }

View file

@ -226,7 +226,7 @@ public:
int int
show_create_function(THD *thd); show_create_function(THD *thd);
void int
add_instr(sp_instr *instr); add_instr(sp_instr *instr);
inline uint inline uint
@ -254,7 +254,7 @@ public:
restore_lex(THD *thd); restore_lex(THD *thd);
// Put the instruction on the backpatch list, associated with the label. // Put the instruction on the backpatch list, associated with the label.
void int
push_backpatch(sp_instr *, struct sp_label *); push_backpatch(sp_instr *, struct sp_label *);
// Update all instruction with this label in the backpatch list to // Update all instruction with this label in the backpatch list to
@ -263,11 +263,11 @@ public:
backpatch(struct sp_label *); backpatch(struct sp_label *);
// Start a new cont. backpatch level. If 'i' is NULL, the level is just incr. // Start a new cont. backpatch level. If 'i' is NULL, the level is just incr.
void int
new_cont_backpatch(sp_instr_opt_meta *i); new_cont_backpatch(sp_instr_opt_meta *i);
// Add an instruction to the current level // Add an instruction to the current level
void int
add_cont_backpatch(sp_instr_opt_meta *i); add_cont_backpatch(sp_instr_opt_meta *i);
// Backpatch (and pop) the current level to the current position. // Backpatch (and pop) the current level to the current position.

View file

@ -263,7 +263,8 @@ sp_pcontext::push_variable(LEX_STRING *name, enum enum_field_types type,
p->mode= mode; p->mode= mode;
p->offset= current_var_count(); p->offset= current_var_count();
p->dflt= NULL; p->dflt= NULL;
insert_dynamic(&m_vars, (gptr)&p); if (insert_dynamic(&m_vars, (gptr)&p))
return NULL;
return p; return p;
} }
@ -308,18 +309,17 @@ sp_pcontext::find_label(char *name)
return NULL; return NULL;
} }
void int
sp_pcontext::push_cond(LEX_STRING *name, sp_cond_type_t *val) sp_pcontext::push_cond(LEX_STRING *name, sp_cond_type_t *val)
{ {
sp_cond_t *p= (sp_cond_t *)sql_alloc(sizeof(sp_cond_t)); sp_cond_t *p= (sp_cond_t *)sql_alloc(sizeof(sp_cond_t));
if (p) if (p == NULL)
{ return 1;
p->name.str= name->str; p->name.str= name->str;
p->name.length= name->length; p->name.length= name->length;
p->val= val; p->val= val;
insert_dynamic(&m_conds, (gptr)&p); return insert_dynamic(&m_conds, (gptr)&p);
}
} }
/* /*
@ -382,7 +382,7 @@ sp_pcontext::find_handler(sp_cond_type_t *cond)
return FALSE; return FALSE;
} }
void int
sp_pcontext::push_cursor(LEX_STRING *name) sp_pcontext::push_cursor(LEX_STRING *name)
{ {
LEX_STRING n; LEX_STRING n;
@ -391,7 +391,7 @@ sp_pcontext::push_cursor(LEX_STRING *name)
m_max_cursor_index+= 1; m_max_cursor_index+= 1;
n.str= name->str; n.str= name->str;
n.length= name->length; n.length= name->length;
insert_dynamic(&m_cursors, (gptr)&n); return insert_dynamic(&m_cursors, (gptr)&n);
} }
/* /*

View file

@ -323,7 +323,7 @@ public:
// Conditions // Conditions
// //
void int
push_cond(LEX_STRING *name, sp_cond_type_t *val); push_cond(LEX_STRING *name, sp_cond_type_t *val);
inline void inline void
@ -365,7 +365,7 @@ public:
// Cursors // Cursors
// //
void int
push_cursor(LEX_STRING *name); push_cursor(LEX_STRING *name);
my_bool my_bool

View file

@ -3371,10 +3371,6 @@ add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level,
} }
} }
/*
Add all keys with uses 'field' for some keypart
If field->and_level != and_level then only mark key_part as const_part
*/
static uint static uint
max_part_bit(key_part_map bits) max_part_bit(key_part_map bits)
@ -3384,7 +3380,16 @@ max_part_bit(key_part_map bits)
return found; return found;
} }
static void /*
Add all keys with uses 'field' for some keypart
If field->and_level != and_level then only mark key_part as const_part
RETURN
0 - OK
1 - Out of memory.
*/
static bool
add_key_part(DYNAMIC_ARRAY *keyuse_array,KEY_FIELD *key_field) add_key_part(DYNAMIC_ARRAY *keyuse_array,KEY_FIELD *key_field)
{ {
Field *field=key_field->field; Field *field=key_field->field;
@ -3414,24 +3419,26 @@ add_key_part(DYNAMIC_ARRAY *keyuse_array,KEY_FIELD *key_field)
keyuse.optimize= key_field->optimize & KEY_OPTIMIZE_REF_OR_NULL; keyuse.optimize= key_field->optimize & KEY_OPTIMIZE_REF_OR_NULL;
keyuse.null_rejecting= key_field->null_rejecting; keyuse.null_rejecting= key_field->null_rejecting;
keyuse.cond_guard= key_field->cond_guard; keyuse.cond_guard= key_field->cond_guard;
VOID(insert_dynamic(keyuse_array,(gptr) &keyuse)); if (insert_dynamic(keyuse_array,(gptr) &keyuse))
return TRUE;
} }
} }
} }
} }
return FALSE;
} }
#define FT_KEYPART (MAX_REF_PARTS+10) #define FT_KEYPART (MAX_REF_PARTS+10)
static void static bool
add_ft_keys(DYNAMIC_ARRAY *keyuse_array, add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
JOIN_TAB *stat,COND *cond,table_map usable_tables) JOIN_TAB *stat,COND *cond,table_map usable_tables)
{ {
Item_func_match *cond_func=NULL; Item_func_match *cond_func=NULL;
if (!cond) if (!cond)
return; return FALSE;
if (cond->type() == Item::FUNC_ITEM) if (cond->type() == Item::FUNC_ITEM)
{ {
@ -3465,13 +3472,16 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
{ {
Item *item; Item *item;
while ((item=li++)) while ((item=li++))
add_ft_keys(keyuse_array,stat,item,usable_tables); {
if (add_ft_keys(keyuse_array,stat,item,usable_tables))
return TRUE;
}
} }
} }
if (!cond_func || cond_func->key == NO_SUCH_KEY || if (!cond_func || cond_func->key == NO_SUCH_KEY ||
!(usable_tables & cond_func->table->map)) !(usable_tables & cond_func->table->map))
return; return FALSE;
KEYUSE keyuse; KEYUSE keyuse;
keyuse.table= cond_func->table; keyuse.table= cond_func->table;
@ -3481,7 +3491,7 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
keyuse.used_tables=cond_func->key_item()->used_tables(); keyuse.used_tables=cond_func->key_item()->used_tables();
keyuse.optimize= 0; keyuse.optimize= 0;
keyuse.keypart_map= 0; keyuse.keypart_map= 0;
VOID(insert_dynamic(keyuse_array,(gptr) &keyuse)); return insert_dynamic(keyuse_array,(gptr) &keyuse);
} }
@ -3631,7 +3641,8 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
sargables); sargables);
for (; field != end ; field++) for (; field != end ; field++)
{ {
add_key_part(keyuse,field); if (add_key_part(keyuse,field))
return TRUE;
/* Mark that we can optimize LEFT JOIN */ /* Mark that we can optimize LEFT JOIN */
if (field->val->type() == Item::NULL_ITEM && if (field->val->type() == Item::NULL_ITEM &&
!field->field->real_maybe_null()) !field->field->real_maybe_null())
@ -3669,11 +3680,15 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
/* fill keyuse with found key parts */ /* fill keyuse with found key parts */
for ( ; field != end ; field++) for ( ; field != end ; field++)
add_key_part(keyuse,field); {
if (add_key_part(keyuse,field))
return TRUE;
}
if (select_lex->ftfunc_list->elements) if (select_lex->ftfunc_list->elements)
{ {
add_ft_keys(keyuse,join_tab,cond,normal_tables); if (add_ft_keys(keyuse,join_tab,cond,normal_tables))
return TRUE;
} }
/* /*
@ -3694,7 +3709,8 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
(qsort_cmp) sort_keyuse); (qsort_cmp) sort_keyuse);
bzero((char*) &key_end,sizeof(key_end)); /* Add for easy testing */ bzero((char*) &key_end,sizeof(key_end)); /* Add for easy testing */
VOID(insert_dynamic(keyuse,(gptr) &key_end)); if (insert_dynamic(keyuse,(gptr) &key_end))
return TRUE;
use=save_pos=dynamic_element(keyuse,0,KEYUSE*); use=save_pos=dynamic_element(keyuse,0,KEYUSE*);
prev= &key_end; prev= &key_end;

View file

@ -4376,6 +4376,16 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
{ {
for (;;) for (;;)
{ {
if (thd->killed)
{
/*
we've been killed; let handler clean up, and remove the
partial current row from the recordset (embedded lib)
*/
t->file->ha_rnd_end();
thd->protocol->remove_last_row();
goto err;
}
ha_checksum row_crc= 0; ha_checksum row_crc= 0;
int error= t->file->rnd_next(t->record[0]); int error= t->file->rnd_next(t->record[0]);
if (unlikely(error)) if (unlikely(error))

View file

@ -234,9 +234,7 @@ int case_stmt_action_expr(LEX *lex, Item* expr)
parsing_ctx, case_expr_id, expr, lex); parsing_ctx, case_expr_id, expr, lex);
sp->add_cont_backpatch(i); sp->add_cont_backpatch(i);
sp->add_instr(i); return sp->add_instr(i);
return 0;
} }
/** /**
@ -247,7 +245,7 @@ int case_stmt_action_expr(LEX *lex, Item* expr)
@param simple true for simple cases, false for searched cases @param simple true for simple cases, false for searched cases
*/ */
void case_stmt_action_when(LEX *lex, Item *when, bool simple) int case_stmt_action_when(LEX *lex, Item *when, bool simple)
{ {
sp_head *sp= lex->sphead; sp_head *sp= lex->sphead;
sp_pcontext *ctx= lex->spcont; sp_pcontext *ctx= lex->spcont;
@ -279,9 +277,10 @@ void case_stmt_action_when(LEX *lex, Item *when, bool simple)
(jump_if_not from instruction 2 to 5, 5 to 8 ... in the example) (jump_if_not from instruction 2 to 5, 5 to 8 ... in the example)
*/ */
sp->push_backpatch(i, ctx->push_label((char *)"", 0)); return !test(i) ||
sp->add_cont_backpatch(i); sp->push_backpatch(i, ctx->push_label((char *)"", 0)) ||
sp->add_instr(i); sp->add_cont_backpatch(i) ||
sp->add_instr(i);
} }
/** /**
@ -290,13 +289,14 @@ void case_stmt_action_when(LEX *lex, Item *when, bool simple)
@param lex the parser lex context @param lex the parser lex context
*/ */
void case_stmt_action_then(LEX *lex) int case_stmt_action_then(LEX *lex)
{ {
sp_head *sp= lex->sphead; sp_head *sp= lex->sphead;
sp_pcontext *ctx= lex->spcont; sp_pcontext *ctx= lex->spcont;
uint ip= sp->instructions(); uint ip= sp->instructions();
sp_instr_jump *i = new sp_instr_jump(ip, ctx); sp_instr_jump *i = new sp_instr_jump(ip, ctx);
sp->add_instr(i); if (!test(i) || sp->add_instr(i))
return 1;
/* /*
BACKPATCH: Resolving forward jump from BACKPATCH: Resolving forward jump from
@ -312,7 +312,7 @@ void case_stmt_action_then(LEX *lex)
(jump from instruction 4 to 12, 7 to 12 ... in the example) (jump from instruction 4 to 12, 7 to 12 ... in the example)
*/ */
sp->push_backpatch(i, ctx->last_label()); return sp->push_backpatch(i, ctx->last_label());
} }
/** /**
@ -1905,10 +1905,9 @@ sp_decl:
var_type, var_type,
lex, lex,
(i == num_vars - 1)); (i == num_vars - 1));
if (is == NULL) if (is == NULL ||
lex->sphead->add_instr(is))
MYSQL_YYABORT; MYSQL_YYABORT;
lex->sphead->add_instr(is);
} }
pctx->declare_var_boundary(0); pctx->declare_var_boundary(0);
@ -1927,7 +1926,8 @@ sp_decl:
my_error(ER_SP_DUP_COND, MYF(0), $2.str); my_error(ER_SP_DUP_COND, MYF(0), $2.str);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
YYTHD->lex->spcont->push_cond(&$2, $5); if(YYTHD->lex->spcont->push_cond(&$2, $5))
MYSQL_YYABORT;
$$.vars= $$.hndlrs= $$.curs= 0; $$.vars= $$.hndlrs= $$.curs= 0;
$$.conds= 1; $$.conds= 1;
} }
@ -1942,10 +1942,10 @@ sp_decl:
sp_instr_hpush_jump *i= sp_instr_hpush_jump *i=
new sp_instr_hpush_jump(sp->instructions(), ctx, $2, new sp_instr_hpush_jump(sp->instructions(), ctx, $2,
ctx->current_var_count()); ctx->current_var_count());
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
sp->push_backpatch(i, ctx->push_label((char *)"", 0)); sp->push_backpatch(i, ctx->push_label((char *)"", 0));
} }
sp_hcond_list sp_proc_stmt sp_hcond_list sp_proc_stmt
@ -1960,17 +1960,17 @@ sp_decl:
{ {
i= new sp_instr_hreturn(sp->instructions(), ctx, i= new sp_instr_hreturn(sp->instructions(), ctx,
ctx->current_var_count()); ctx->current_var_count());
if (i == NULL ) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
} }
else else
{ /* EXIT or UNDO handler, just jump to the end of the block */ { /* EXIT or UNDO handler, just jump to the end of the block */
i= new sp_instr_hreturn(sp->instructions(), ctx, 0); i= new sp_instr_hreturn(sp->instructions(), ctx, 0);
if (i == NULL) if (i == NULL ||
sp->add_instr(i) ||
sp->push_backpatch(i, lex->spcont->last_label())) /* Block end */
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
sp->push_backpatch(i, lex->spcont->last_label()); /* Block end */
} }
lex->sphead->backpatch(hlab); lex->sphead->backpatch(hlab);
@ -1996,10 +1996,10 @@ sp_decl:
} }
i= new sp_instr_cpush(sp->instructions(), ctx, $5, i= new sp_instr_cpush(sp->instructions(), ctx, $5,
ctx->current_cursor_count()); ctx->current_cursor_count());
if (i == NULL) if (i == NULL ||
sp->add_instr(i) ||
ctx->push_cursor(&$2))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
ctx->push_cursor(&$2);
$$.vars= $$.conds= $$.hndlrs= 0; $$.vars= $$.conds= $$.hndlrs= 0;
$$.curs= 1; $$.curs= 1;
} }
@ -2223,10 +2223,11 @@ sp_proc_stmt:
i->m_query.length= lip->ptr - sp->m_tmp_query; i->m_query.length= lip->ptr - sp->m_tmp_query;
else else
i->m_query.length= lip->tok_end - sp->m_tmp_query; i->m_query.length= lip->tok_end - sp->m_tmp_query;
i->m_query.str= strmake_root(thd->mem_root, if (!(i->m_query.str= strmake_root(thd->mem_root,
sp->m_tmp_query, sp->m_tmp_query,
i->m_query.length); i->m_query.length)) ||
sp->add_instr(i); sp->add_instr(i))
MYSQL_YYABORT;
} }
sp->restore_lex(thd); sp->restore_lex(thd);
} }
@ -2251,9 +2252,9 @@ sp_proc_stmt:
i= new sp_instr_freturn(sp->instructions(), lex->spcont, $3, i= new sp_instr_freturn(sp->instructions(), lex->spcont, $3,
sp->m_return_field_def.sql_type, lex); sp->m_return_field_def.sql_type, lex);
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
sp->m_flags|= sp_head::HAS_RETURN; sp->m_flags|= sp_head::HAS_RETURN;
} }
sp->restore_lex(YYTHD); sp->restore_lex(YYTHD);
@ -2311,23 +2312,23 @@ sp_proc_stmt:
if (n) if (n)
{ {
sp_instr_hpop *hpop= new sp_instr_hpop(ip++, ctx, n); sp_instr_hpop *hpop= new sp_instr_hpop(ip++, ctx, n);
if (hpop == NULL) if (hpop == NULL ||
sp->add_instr(hpop))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(hpop);
} }
n= ctx->diff_cursors(lab->ctx, exclusive); n= ctx->diff_cursors(lab->ctx, exclusive);
if (n) if (n)
{ {
sp_instr_cpop *cpop= new sp_instr_cpop(ip++, ctx, n); sp_instr_cpop *cpop= new sp_instr_cpop(ip++, ctx, n);
if (cpop == NULL) if (cpop == NULL ||
sp->add_instr(cpop))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(cpop);
} }
i= new sp_instr_jump(ip, ctx); i= new sp_instr_jump(ip, ctx);
if (i == NULL) if (i == NULL ||
sp->push_backpatch(i, lab) || /* Jumping forward */
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->push_backpatch(i, lab); /* Jumping forward */
sp->add_instr(i);
} }
} }
| ITERATE_SYM label_ident | ITERATE_SYM label_ident
@ -2352,22 +2353,22 @@ sp_proc_stmt:
if (n) if (n)
{ {
sp_instr_hpop *hpop= new sp_instr_hpop(ip++, ctx, n); sp_instr_hpop *hpop= new sp_instr_hpop(ip++, ctx, n);
if (hpop == NULL) if (hpop == NULL ||
sp->add_instr(hpop))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(hpop);
} }
n= ctx->diff_cursors(lab->ctx, FALSE); /* Inclusive the dest. */ n= ctx->diff_cursors(lab->ctx, FALSE); /* Inclusive the dest. */
if (n) if (n)
{ {
sp_instr_cpop *cpop= new sp_instr_cpop(ip++, ctx, n); sp_instr_cpop *cpop= new sp_instr_cpop(ip++, ctx, n);
if (cpop == NULL) if (cpop == NULL ||
sp->add_instr(cpop))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(cpop);
} }
i= new sp_instr_jump(ip, ctx, lab->ip); /* Jump back */ i= new sp_instr_jump(ip, ctx, lab->ip); /* Jump back */
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
} }
} }
| OPEN_SYM ident | OPEN_SYM ident
@ -2383,9 +2384,9 @@ sp_proc_stmt:
MYSQL_YYABORT; MYSQL_YYABORT;
} }
i= new sp_instr_copen(sp->instructions(), lex->spcont, offset); i= new sp_instr_copen(sp->instructions(), lex->spcont, offset);
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
} }
| FETCH_SYM sp_opt_fetch_noise ident INTO | FETCH_SYM sp_opt_fetch_noise ident INTO
{ {
@ -2400,9 +2401,9 @@ sp_proc_stmt:
MYSQL_YYABORT; MYSQL_YYABORT;
} }
i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset); i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset);
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
} }
sp_fetch_list sp_fetch_list
{ } { }
@ -2419,9 +2420,9 @@ sp_proc_stmt:
MYSQL_YYABORT; MYSQL_YYABORT;
} }
i= new sp_instr_cclose(sp->instructions(), lex->spcont, offset); i= new sp_instr_cclose(sp->instructions(), lex->spcont, offset);
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
} }
; ;
@ -2488,11 +2489,11 @@ sp_if:
uint ip= sp->instructions(); uint ip= sp->instructions();
sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, ctx, sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, ctx,
$2, lex); $2, lex);
if (i == NULL) if (i == NULL ||
sp->push_backpatch(i, ctx->push_label((char *)"", 0)) ||
sp->add_cont_backpatch(i) ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->push_backpatch(i, ctx->push_label((char *)"", 0));
sp->add_cont_backpatch(i);
sp->add_instr(i);
sp->restore_lex(YYTHD); sp->restore_lex(YYTHD);
} }
sp_proc_stmts1 sp_proc_stmts1
@ -2501,9 +2502,9 @@ sp_if:
sp_pcontext *ctx= Lex->spcont; sp_pcontext *ctx= Lex->spcont;
uint ip= sp->instructions(); uint ip= sp->instructions();
sp_instr_jump *i = new sp_instr_jump(ip, ctx); sp_instr_jump *i = new sp_instr_jump(ip, ctx);
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
sp->backpatch(ctx->pop_label()); sp->backpatch(ctx->pop_label());
sp->push_backpatch(i, ctx->push_label((char *)"", 0)); sp->push_backpatch(i, ctx->push_label((char *)"", 0));
} }
@ -2589,14 +2590,16 @@ simple_when_clause:
/* Simple case: <caseval> = <whenval> */ /* Simple case: <caseval> = <whenval> */
LEX *lex= Lex; LEX *lex= Lex;
case_stmt_action_when(lex, $3, true); if (case_stmt_action_when(lex, $3, true))
MYSQL_YYABORT;
lex->sphead->restore_lex(YYTHD); /* For expr $3 */ lex->sphead->restore_lex(YYTHD); /* For expr $3 */
} }
THEN_SYM THEN_SYM
sp_proc_stmts1 sp_proc_stmts1
{ {
LEX *lex= Lex; LEX *lex= Lex;
case_stmt_action_then(lex); if (case_stmt_action_then(lex))
MYSQL_YYABORT;
} }
; ;
@ -2609,14 +2612,16 @@ searched_when_clause:
expr expr
{ {
LEX *lex= Lex; LEX *lex= Lex;
case_stmt_action_when(lex, $3, false); if (case_stmt_action_when(lex, $3, false))
MYSQL_YYABORT;
lex->sphead->restore_lex(YYTHD); /* For expr $3 */ lex->sphead->restore_lex(YYTHD); /* For expr $3 */
} }
THEN_SYM THEN_SYM
sp_proc_stmts1 sp_proc_stmts1
{ {
LEX *lex= Lex; LEX *lex= Lex;
case_stmt_action_then(lex); if (case_stmt_action_then(lex))
MYSQL_YYABORT;
} }
; ;
@ -2628,9 +2633,9 @@ else_clause_opt:
uint ip= sp->instructions(); uint ip= sp->instructions();
sp_instr_error *i= new sp_instr_error(ip, lex->spcont, sp_instr_error *i= new sp_instr_error(ip, lex->spcont,
ER_SP_CASE_NOT_FOUND); ER_SP_CASE_NOT_FOUND);
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
} }
| ELSE sp_proc_stmts1 | ELSE sp_proc_stmts1
; ;
@ -2744,17 +2749,17 @@ sp_block_content:
{ {
sp_instr_hpop *hpop= new sp_instr_hpop(sp->instructions(), ctx, sp_instr_hpop *hpop= new sp_instr_hpop(sp->instructions(), ctx,
$3.hndlrs); $3.hndlrs);
if (hpop == NULL) if (hpop == NULL ||
sp->add_instr(hpop))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(hpop);
} }
if ($3.curs) if ($3.curs)
{ {
sp_instr_cpop *cpop= new sp_instr_cpop(sp->instructions(), ctx, sp_instr_cpop *cpop= new sp_instr_cpop(sp->instructions(), ctx,
$3.curs); $3.curs);
if (cpop == NULL) if (cpop == NULL ||
sp->add_instr(cpop))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(cpop);
} }
lex->spcont= ctx->pop_context(); lex->spcont= ctx->pop_context();
} }
@ -2768,9 +2773,9 @@ sp_unlabeled_control:
uint ip= lex->sphead->instructions(); uint ip= lex->sphead->instructions();
sp_label_t *lab= lex->spcont->last_label(); /* Jumping back */ sp_label_t *lab= lex->spcont->last_label(); /* Jumping back */
sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip); sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip);
if (i == NULL) if (i == NULL ||
lex->sphead->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
lex->sphead->add_instr(i);
} }
| WHILE_SYM | WHILE_SYM
{ {
@ -2784,12 +2789,12 @@ sp_unlabeled_control:
uint ip= sp->instructions(); uint ip= sp->instructions();
sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, lex->spcont, sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, lex->spcont,
$3, lex); $3, lex);
if (i == NULL) if (i == NULL ||
MYSQL_YYABORT;
/* Jumping forward */ /* Jumping forward */
sp->push_backpatch(i, lex->spcont->last_label()); sp->push_backpatch(i, lex->spcont->last_label()) ||
sp->new_cont_backpatch(i); sp->new_cont_backpatch(i) ||
sp->add_instr(i); sp->add_instr(i))
MYSQL_YYABORT;
sp->restore_lex(YYTHD); sp->restore_lex(YYTHD);
} }
sp_proc_stmts1 END WHILE_SYM sp_proc_stmts1 END WHILE_SYM
@ -2798,9 +2803,9 @@ sp_unlabeled_control:
uint ip= lex->sphead->instructions(); uint ip= lex->sphead->instructions();
sp_label_t *lab= lex->spcont->last_label(); /* Jumping back */ sp_label_t *lab= lex->spcont->last_label(); /* Jumping back */
sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip); sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip);
if (i == NULL) if (i == NULL ||
lex->sphead->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
lex->sphead->add_instr(i);
lex->sphead->do_cont_backpatch(); lex->sphead->do_cont_backpatch();
} }
| REPEAT_SYM sp_proc_stmts1 UNTIL_SYM | REPEAT_SYM sp_proc_stmts1 UNTIL_SYM
@ -2816,9 +2821,9 @@ sp_unlabeled_control:
sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, lex->spcont, sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, lex->spcont,
$5, lab->ip, $5, lab->ip,
lex); lex);
if (i == NULL) if (i == NULL ||
lex->sphead->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
lex->sphead->add_instr(i);
lex->sphead->restore_lex(YYTHD); lex->sphead->restore_lex(YYTHD);
/* We can shortcut the cont_backpatch here */ /* We can shortcut the cont_backpatch here */
i->m_cont_dest= ip+1; i->m_cont_dest= ip+1;
@ -9649,7 +9654,8 @@ option_type_value:
qbuff.length); qbuff.length);
qbuff.length+= 4; qbuff.length+= 4;
i->m_query= qbuff; i->m_query= qbuff;
sp->add_instr(i); if (sp->add_instr(i))
MYSQL_YYABORT;
} }
lex->sphead->restore_lex(thd); lex->sphead->restore_lex(thd);
} }
@ -9731,7 +9737,8 @@ sys_option_value:
lex->trg_table_fields.link_in_list((byte *)trg_fld, lex->trg_table_fields.link_in_list((byte *)trg_fld,
(byte **)&trg_fld->next_trg_field); (byte **)&trg_fld->next_trg_field);
lex->sphead->add_instr(sp_fld); if (lex->sphead->add_instr(sp_fld))
MYSQL_YYABORT;
} }
else if ($2.var) else if ($2.var)
{ /* System variable */ { /* System variable */
@ -9761,11 +9768,12 @@ sys_option_value:
it= spv->dflt; it= spv->dflt;
else else
it= new Item_null(); it= new Item_null();
if (it == NULL) if (it == NULL ||
(sp_set= new sp_instr_set(lex->sphead->instructions(), ctx,
spv->offset, it, spv->type, lex,
TRUE)) == NULL ||
lex->sphead->add_instr(sp_set))
MYSQL_YYABORT; MYSQL_YYABORT;
sp_set= new sp_instr_set(lex->sphead->instructions(), ctx,
spv->offset, it, spv->type, lex, TRUE);
lex->sphead->add_instr(sp_set);
} }
} }
| option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types | option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types

View file

@ -15904,61 +15904,6 @@ static void test_bug28934()
} }
#ifdef HAVE_SPATIAL
/**
Bug#37956 memory leak and / or crash with geometry and prepared statements!
*/
static void test_bug37956(void)
{
const char *query="select point(?,?)";
MYSQL_STMT *stmt=NULL;
ulong val=0;
MYSQL_BIND bind_param[2];
unsigned char buff[2]= { 134, 211 };
DBUG_ENTER("test_bug37956");
myheader("test_bug37956");
stmt= mysql_simple_prepare(mysql, query);
check_stmt(stmt);
val=1;
mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void *)&val);
val=CURSOR_TYPE_READ_ONLY;
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void *)&val);
val=0;
mysql_stmt_attr_set(stmt, STMT_ATTR_PREFETCH_ROWS, (void *)&val);
memset(bind_param, 0, sizeof(bind_param));
bind_param[0].buffer_type=MYSQL_TYPE_TINY;
bind_param[0].buffer= (void *)buff;
bind_param[0].is_null=NULL;
bind_param[0].error=NULL;
bind_param[0].is_unsigned=1;
bind_param[1].buffer_type=MYSQL_TYPE_TINY;
bind_param[1].buffer= (void *)(buff+1);
bind_param[1].is_null=NULL;
bind_param[1].error=NULL;
bind_param[1].is_unsigned=1;
if (mysql_stmt_bind_param(stmt, bind_param))
{
mysql_stmt_close(stmt);
DIE_UNLESS(0);
}
if (mysql_stmt_execute(stmt))
{
mysql_stmt_close(stmt);
DBUG_VOID_RETURN;
}
/* Should never reach here: execution returns an error. */
mysql_stmt_close(stmt);
DIE_UNLESS(0);
DBUG_VOID_RETURN;
}
#endif
/* /*
Bug#27592 (stack overrun when storing datetime value using prepared statements) Bug#27592 (stack overrun when storing datetime value using prepared statements)
*/ */
@ -16945,9 +16890,6 @@ static struct my_tests_st my_tests[]= {
{ "test_bug32265", test_bug32265 }, { "test_bug32265", test_bug32265 },
{ "test_bug38486", test_bug38486 }, { "test_bug38486", test_bug38486 },
{ "test_bug40365", test_bug40365 }, { "test_bug40365", test_bug40365 },
#ifdef HAVE_SPATIAL
{ "test_bug37956", test_bug37956 },
#endif
#ifdef HAVE_QUERY_CACHE #ifdef HAVE_QUERY_CACHE
{ "test_bug36326", test_bug36326 }, { "test_bug36326", test_bug36326 },
#endif #endif