summaryrefslogtreecommitdiff
path: root/tests/mysql_client_test.c
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-02-03 17:01:31 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2022-02-03 17:01:31 +0100
commitf5c5f8e41ecd4d407022d3772ac43075c16824a5 (patch)
tree8a46fbd9dfd51352800ea606ae52a53ceb239501 /tests/mysql_client_test.c
parent8d742fe4acb91652fcbeb36506d20ead4ff19e83 (diff)
parentcf63eecef44f189ce2d221612dee9dfc1885ba4e (diff)
downloadmariadb-git-f5c5f8e41ecd4d407022d3772ac43075c16824a5.tar.gz
Merge branch '10.5' into 10.6
Diffstat (limited to 'tests/mysql_client_test.c')
-rw-r--r--tests/mysql_client_test.c89
1 files changed, 88 insertions, 1 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index fb0ed50b8d7..53873eb1895 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2002, 2014, Oracle and/or its affiliates.
- Copyright (c) 2008, 2021, MariaDB
+ Copyright (c) 2008, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20858,6 +20858,91 @@ static void test_mdev_26145()
myquery(rc);
}
+static void test_mdev24827()
+{
+ int rc;
+ MYSQL_STMT *stmt;
+ unsigned long cursor = CURSOR_TYPE_READ_ONLY;
+ const char* query=
+ "SELECT t2.c1 AS c1 FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1 "
+ "WHERE EXISTS (SELECT 1 FROM t1 WHERE c2 = -1) ORDER BY c1";
+
+ myheader("test_mdev24827");
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t2");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT)");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "CREATE TABLE t2 (c1 INT PRIMARY KEY, c2 INT, "
+ "KEY idx_c2(c2))");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "INSERT INTO t1 (c1, c2) "
+ "SELECT seq, seq FROM seq_1_to_10000");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "INSERT INTO t2 (c1, c2) "
+ "SELECT seq, seq FROM seq_1_to_20000");
+ myquery(rc);
+
+ stmt= mysql_stmt_init(mysql);
+ check_stmt(stmt);
+
+ rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, &cursor);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ mysql_stmt_close(stmt);
+
+ rc= mysql_query(mysql, "DROP TABLE t1");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "DROP TABLE t2");
+ myquery(rc);
+}
+
+static void test_mdev_20516()
+{
+ MYSQL_STMT *stmt;
+ int rc;
+ unsigned long cursor= CURSOR_TYPE_READ_ONLY;
+ const char* query=
+ "CREATE VIEW v1 AS SELECT * FROM t1";
+
+ myheader("test_mdev_20516");
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "CREATE TABLE t1(a INT)");
+ myquery(rc);
+
+ stmt= mysql_stmt_init(mysql);
+ check_stmt(stmt);
+
+ rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, &cursor);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ mysql_stmt_close(stmt);
+
+ rc= mysql_query(mysql, "DROP TABLE t1");
+ myquery(rc);
+}
+
static void print_metadata(MYSQL_RES *rs_metadata, int num_fields)
{
int i;
@@ -21523,6 +21608,8 @@ static void test_cache_metadata()
static struct my_tests_st my_tests[]= {
+ { "test_mdev_20516", test_mdev_20516 },
+ { "test_mdev24827", test_mdev24827 },
{ "test_mdev_26145", test_mdev_26145 },
{ "disable_query_logs", disable_query_logs },
{ "test_view_sp_list_fields", test_view_sp_list_fields },