mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-22 22:20:02 +00:00
feat!: improve mysql/pg compatibility (#7315)
* feat(mysql): add SHOW WARNINGS support and return warnings for unsupported SET variables Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat(function): add MySQL IF() function and PostgreSQL description functions for connector compatibility Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix: show tables for mysql Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix: partitions table in information_schema and add starrocks external catalog compatibility Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor: async udf Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix: set warnings Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat: impl pg_my_temp_schema and make description functions simple Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test: add test for issue 7313 Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat: apply suggestions Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix: partition_expression and partition_description Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix: test Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix: unit tests Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix: saerch_path only works for pg Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * feat: improve warnings processing Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix: warnings while writing affected rows and refactor Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * chore: improve ShobjDescriptionFunction signature Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * refactor: array_to_boolean Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -478,11 +478,11 @@ async fn test_execute_show_databases_tables(instance: Arc<dyn MockInstance>) {
|
||||
check_unordered_output_stream(output, expected).await;
|
||||
|
||||
let expected = "\
|
||||
+---------+
|
||||
| Tables |
|
||||
+---------+
|
||||
| numbers |
|
||||
+---------+\
|
||||
+------------------+
|
||||
| Tables_in_public |
|
||||
+------------------+
|
||||
| numbers |
|
||||
+------------------+\
|
||||
";
|
||||
let output = execute_sql(&instance, "show tables").await;
|
||||
check_unordered_output_stream(output, expected).await;
|
||||
@@ -494,23 +494,23 @@ async fn test_execute_show_databases_tables(instance: Arc<dyn MockInstance>) {
|
||||
|
||||
let output = execute_sql(&instance, "show tables").await;
|
||||
let expected = "\
|
||||
+---------+
|
||||
| Tables |
|
||||
+---------+
|
||||
| demo |
|
||||
| numbers |
|
||||
+---------+\
|
||||
+------------------+
|
||||
| Tables_in_public |
|
||||
+------------------+
|
||||
| demo |
|
||||
| numbers |
|
||||
+------------------+\
|
||||
";
|
||||
check_unordered_output_stream(output, expected).await;
|
||||
|
||||
let output = execute_sql(&instance, "SHOW FULL TABLES WHERE Table_type != 'VIEW'").await;
|
||||
let expected = "\
|
||||
+---------+-----------------+
|
||||
| Tables | Table_type |
|
||||
+---------+-----------------+
|
||||
| demo | BASE TABLE |
|
||||
| numbers | LOCAL TEMPORARY |
|
||||
+---------+-----------------+\
|
||||
+------------------+-----------------+
|
||||
| Tables_in_public | Table_type |
|
||||
+------------------+-----------------+
|
||||
| demo | BASE TABLE |
|
||||
| numbers | LOCAL TEMPORARY |
|
||||
+------------------+-----------------+\
|
||||
";
|
||||
check_unordered_output_stream(output, expected).await;
|
||||
|
||||
@@ -520,22 +520,22 @@ async fn test_execute_show_databases_tables(instance: Arc<dyn MockInstance>) {
|
||||
)
|
||||
.await;
|
||||
let expected = "\
|
||||
+--------+------------+
|
||||
| Tables | Table_type |
|
||||
+--------+------------+
|
||||
| demo | BASE TABLE |
|
||||
+--------+------------+\
|
||||
+------------------+------------+
|
||||
| Tables_in_public | Table_type |
|
||||
+------------------+------------+
|
||||
| demo | BASE TABLE |
|
||||
+------------------+------------+\
|
||||
";
|
||||
check_unordered_output_stream(output, expected).await;
|
||||
|
||||
// show tables like [string]
|
||||
let output = execute_sql(&instance, "show tables like 'de%'").await;
|
||||
let expected = "\
|
||||
+--------+
|
||||
| Tables |
|
||||
+--------+
|
||||
| demo |
|
||||
+--------+\
|
||||
+------------------+
|
||||
| Tables_in_public |
|
||||
+------------------+
|
||||
| demo |
|
||||
+------------------+\
|
||||
";
|
||||
check_unordered_output_stream(output, expected).await;
|
||||
}
|
||||
@@ -1252,11 +1252,11 @@ async fn test_rename_table(instance: Arc<dyn MockInstance>) {
|
||||
.await
|
||||
.data;
|
||||
let expect = "\
|
||||
+------------+
|
||||
| Tables |
|
||||
+------------+
|
||||
| test_table |
|
||||
+------------+";
|
||||
+--------------+
|
||||
| Tables_in_db |
|
||||
+--------------+
|
||||
| test_table |
|
||||
+--------------+";
|
||||
check_output_stream(output, expect).await;
|
||||
|
||||
let output = execute_sql_with(
|
||||
@@ -1323,12 +1323,12 @@ async fn test_create_table_after_rename_table(instance: Arc<dyn MockInstance>) {
|
||||
assert!(matches!(output, OutputData::AffectedRows(0)));
|
||||
|
||||
let expect = "\
|
||||
+------------+
|
||||
| Tables |
|
||||
+------------+
|
||||
| demo |
|
||||
| test_table |
|
||||
+------------+";
|
||||
+--------------+
|
||||
| Tables_in_db |
|
||||
+--------------+
|
||||
| demo |
|
||||
| test_table |
|
||||
+--------------+";
|
||||
let output = execute_sql_with(&instance, "show tables", query_ctx)
|
||||
.await
|
||||
.data;
|
||||
@@ -1516,11 +1516,11 @@ async fn test_use_database(instance: Arc<dyn MockInstance>) {
|
||||
.await
|
||||
.data;
|
||||
let expected = "\
|
||||
+--------+
|
||||
| Tables |
|
||||
+--------+
|
||||
| tb1 |
|
||||
+--------+";
|
||||
+---------------+
|
||||
| Tables_in_db1 |
|
||||
+---------------+
|
||||
| tb1 |
|
||||
+---------------+";
|
||||
check_output_stream(output, expected).await;
|
||||
|
||||
let output = execute_sql_with(
|
||||
|
||||
@@ -409,11 +409,11 @@ async fn test_recover_metadata_failed() {
|
||||
|
||||
// Only grpc_latencies table is visible.
|
||||
let output = execute_sql(&test_context.frontend(), "show tables;").await;
|
||||
let expected = r#"+---------+
|
||||
| Tables |
|
||||
+---------+
|
||||
| numbers |
|
||||
+---------+"#;
|
||||
let expected = r#"+------------------+
|
||||
| Tables_in_public |
|
||||
+------------------+
|
||||
| numbers |
|
||||
+------------------+"#;
|
||||
check_output_stream(output.data, expected).await;
|
||||
|
||||
// Expect table creation to fail because the region directory already exists.
|
||||
@@ -474,12 +474,12 @@ async fn test_dropped_table() {
|
||||
test_context.rebuild().await;
|
||||
|
||||
let output = execute_sql(&test_context.frontend(), "show tables;").await;
|
||||
let expected = r#"+----------------+
|
||||
| Tables |
|
||||
+----------------+
|
||||
| grpc_latencies |
|
||||
| numbers |
|
||||
+----------------+"#;
|
||||
let expected = r#"+------------------+
|
||||
| Tables_in_public |
|
||||
+------------------+
|
||||
| grpc_latencies |
|
||||
| numbers |
|
||||
+------------------+"#;
|
||||
check_output_stream(output.data, expected).await;
|
||||
|
||||
// We can't query the table because the table is dropped.
|
||||
@@ -531,12 +531,12 @@ async fn test_renamed_table() {
|
||||
check_output_stream(output.data, expected).await;
|
||||
|
||||
let output = execute_sql(&test_context.frontend(), "show tables;").await;
|
||||
let expected = r#"+----------------+
|
||||
| Tables |
|
||||
+----------------+
|
||||
| grpc_latencies |
|
||||
| numbers |
|
||||
+----------------+"#;
|
||||
let expected = r#"+------------------+
|
||||
| Tables_in_public |
|
||||
+------------------+
|
||||
| grpc_latencies |
|
||||
| numbers |
|
||||
+------------------+"#;
|
||||
check_output_stream(output.data, expected).await;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user