Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Support function USER() #5023

Closed
TCeason opened this issue Apr 24, 2022 · 2 comments · Fixed by #5584
Closed

Feature: Support function USER() #5023

TCeason opened this issue Apr 24, 2022 · 2 comments · Fixed by #5584
Assignees
Labels
C-feature Category: feature

Comments

@TCeason
Copy link
Collaborator

TCeason commented Apr 24, 2022

Summary

MySQL client always send select USER() to server but databend not support this function. Avoid these err, we can support this function.

2022-04-24T05:42:43.832853Z  INFO databend_query::servers::mysql::mysql_interactive_worker: Normal query: select USER()
2022-04-24T05:42:43.842512Z ERROR databend_query::servers::mysql::writers::query_result_writer: OnQuery Error: Code: 2602, displayText = Unknown Function USER (while in analyze select projection).

   0: common_exception::exception_code::<impl common_exception::exception::ErrorCode>::UnknownUDF
             at common/exception/src/exception_code.rs:36:66
   1: <common_management::udf::udf_mgr::UdfMgr as common_management::udf::udf_api::UdfApi>::get_udf::{{closure}}::{{closure}}
             at common/management/src/udf/udf_mgr.rs:122:31
   2: core::option::Option<T>::ok_or_else
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/option.rs:1075:25
   3: <common_management::udf::udf_mgr::UdfMgr as common_management::udf::udf_api::UdfApi>::get_udf::{{closure}}
             at common/management/src/udf/udf_mgr.rs:122:13
   4: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
   5: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/future.rs:124:9
   6: databend_query::users::user_udf::<impl databend_query::users::user_api::UserApiProvider>::get_udf::{{closure}}
             at query/src/users/user_udf.rs:58:19
   7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
   8: <databend_query::sql::statements::analyzer_expr::ExprRPNBuilder as common_ast::udfs::udf_fetcher::UDFFetcher>::get_udf_definition::{{closure}}
             at query/src/sql/statements/analyzer_expr.rs:656:36
   9: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  10: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/future.rs:124:9
  11: common_ast::udfs::udf_transformer::UDFTransformer::transform_function::{{closure}}
             at common/ast/src/udfs/udf_transformer.rs:35:60
  12: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  13: <databend_query::sql::statements::analyzer_expr::ExprRPNBuilder as common_ast::parser::expr::expr_visitor::ExprVisitor>::pre_visit::{{closure}}
             at query/src/sql/statements/analyzer_expr.rs:672:74
  14: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  15: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/future.rs:124:9
  16: common_ast::parser::expr::expr_visitor::ExprTraverser::accept::{{closure}}
             at common/ast/src/parser/expr/expr_visitor.rs:34:43
  17: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  18: databend_query::sql::statements::analyzer_expr::ExprRPNBuilder::build::{{closure}}
             at query/src/sql/statements/analyzer_expr.rs:500:50
  19: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  20: databend_query::sql::statements::analyzer_expr::ExpressionAnalyzer::analyze::{{closure}}
             at query/src/sql/statements/analyzer_expr.rs:63:75
  21: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  22: databend_query::sql::statements::query::query_normalizer::QueryNormalizer::projection_exprs::{{closure}}
             at query/src/sql/statements/query/query_normalizer.rs:196:68
  23: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  24: databend_query::sql::statements::query::query_normalizer::QueryNormalizer::analyze_projection::{{closure}}
             at query/src/sql/statements/query/query_normalizer.rs:101:66
  25: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  26: databend_query::sql::statements::query::query_normalizer::QueryNormalizer::transform::{{closure}}
             at query/src/sql/statements/query/query_normalizer.rs:68:59
  27: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  28: databend_query::sql::statements::query::query_normalizer::QueryNormalizer::normalize::{{closure}}
             at query/src/sql/statements/query/query_normalizer.rs:60:38
  29: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  30: <databend_query::sql::statements::statement_select::DfQueryStatement as databend_query::sql::statements::analyzer_statement::AnalyzableStatement>::analyze::{{closure}}::{{closure}}
             at query/src/sql/statements/statement_select.rs:66:67
  31: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  32: <databend_query::sql::statements::statement_select::DfQueryStatement as databend_query::sql::statements::analyzer_statement::AnalyzableStatement>::analyze::{{closure}}
             at query/src/sql/statements/statement_select.rs:61:5
  33: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  34: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/future.rs:124:9
  35: <databend_query::sql::sql_statement::DfStatement as databend_query::sql::statements::analyzer_statement::AnalyzableStatement>::analyze::{{closure}}
             at query/src/sql/statements/analyzer_statement.rs:149:52
  36: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  37: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/future.rs:124:9
  38: databend_query::sql::plan_parser::PlanParser::build_plan::{{closure}}
             at query/src/sql/plan_parser.rs:63:49
  39: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  40: databend_query::sql::plan_parser::PlanParser::parse_with_hint::{{closure}}
             at query/src/sql/plan_parser.rs:49:80
  41: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  42: databend_query::servers::mysql::mysql_interactive_worker::InteractiveWorkerBase<W>::do_query::{{closure}}::{{closure}}
             at query/src/servers/mysql/mysql_interactive_worker.rs:276:88
  43: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  44: databend_query::servers::mysql::mysql_interactive_worker::InteractiveWorkerBase<W>::do_query::{{closure}}
             at query/src/servers/mysql/mysql_interactive_worker.rs:262:5
  45: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  46: <databend_query::servers::mysql::mysql_interactive_worker::InteractiveWorker<W> as opensrv_mysql::AsyncMysqlShim<W>>::on_query::{{closure}}
             at query/src/servers/mysql/mysql_interactive_worker.rs:177:47
  47: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  48: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/future.rs:124:9
  49: opensrv_mysql::AsyncMysqlIntermediary<B,S>::run::{{closure}}
             at /home/taichong/.cargo/git/checkouts/opensrv-2d23bfb068524349/967477f/mysql/src/lib.rs:513:30
  50: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  51: opensrv_mysql::AsyncMysqlIntermediary<B,S>::run_with_options::{{closure}}
             at /home/taichong/.cargo/git/checkouts/opensrv-2d23bfb068524349/967477f/mysql/src/lib.rs:250:17
  52: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  53: opensrv_mysql::AsyncMysqlIntermediary<B,S>::run_on::{{closure}}
             at /home/taichong/.cargo/git/checkouts/opensrv-2d23bfb068524349/967477f/mysql/src/lib.rs:230:66
  54: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  55: databend_query::servers::mysql::mysql_session::MySQLConnection::run_on_stream::{{closure}}::{{closure}}
             at query/src/servers/mysql/mysql_session.rs:44:88
  56: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/future/mod.rs:91:19
  57: tokio::runtime::task::core::CoreStage<T>::poll::{{closure}}
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/core.rs:161:17
  58: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/loom/std/unsafe_cell.rs:14:9
  59: tokio::runtime::task::core::CoreStage<T>::poll
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/core.rs:151:13
  60: tokio::runtime::task::harness::poll_future::{{closure}}
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/harness.rs:467:19
  61: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/panic/unwind_safe.rs:271:9
  62: std::panicking::try::do_call
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panicking.rs:492:40
  63: __rust_try
  64: std::panicking::try
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panicking.rs:456:19
  65: std::panic::catch_unwind
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panic.rs:137:14
  66: tokio::runtime::task::harness::poll_future
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/harness.rs:455:18
  67: tokio::runtime::task::harness::Harness<T,S>::poll_inner
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/harness.rs:103:27
  68: tokio::runtime::task::harness::Harness<T,S>::poll
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/harness.rs:57:15
  69: tokio::runtime::task::raw::poll
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/raw.rs:128:5
  70: tokio::runtime::task::raw::RawTask::poll
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/raw.rs:80:18
  71: tokio::runtime::task::LocalNotified<S>::run
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/mod.rs:347:9
  72: tokio::runtime::thread_pool::worker::Context::run_task::{{closure}}
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/thread_pool/worker.rs:425:13
  73: tokio::coop::with_budget::{{closure}}
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:102:9
  74: std::thread::local::LocalKey<T>::try_with
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/thread/local.rs:442:16
  75: std::thread::local::LocalKey<T>::with
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/thread/local.rs:418:9
  76: tokio::coop::with_budget
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:95:5
      tokio::coop::budget
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:72:5
      tokio::runtime::thread_pool::worker::Context::run_task
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/thread_pool/worker.rs:424:9
  77: tokio::runtime::thread_pool::worker::Context::run
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/thread_pool/worker.rs:391:24
  78: tokio::runtime::thread_pool::worker::run::{{closure}}
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/thread_pool/worker.rs:376:17
  79: tokio::macros::scoped_tls::ScopedKey<T>::set
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/macros/scoped_tls.rs:61:9
  80: tokio::runtime::thread_pool::worker::run
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/thread_pool/worker.rs:373:5
  81: tokio::runtime::thread_pool::worker::Launch::launch::{{closure}}
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/thread_pool/worker.rs:352:45
  82: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/blocking/task.rs:42:21
  83: tokio::runtime::task::core::CoreStage<T>::poll::{{closure}}
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/core.rs:161:17
  84: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/loom/std/unsafe_cell.rs:14:9
  85: tokio::runtime::task::core::CoreStage<T>::poll
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/core.rs:151:13
  86: tokio::runtime::task::harness::poll_future::{{closure}}
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/harness.rs:467:19
  87: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/panic/unwind_safe.rs:271:9
  88: std::panicking::try::do_call
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panicking.rs:492:40
  89: __rust_try
  90: std::panicking::try
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panicking.rs:456:19
  91: std::panic::catch_unwind
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panic.rs:137:14
  92: tokio::runtime::task::harness::poll_future
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/harness.rs:455:18
  93: tokio::runtime::task::harness::Harness<T,S>::poll_inner
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/harness.rs:103:27
  94: tokio::runtime::task::harness::Harness<T,S>::poll
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/harness.rs:57:15
  95: tokio::runtime::task::raw::poll
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/raw.rs:128:5
  96: tokio::runtime::task::raw::RawTask::poll
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/raw.rs:80:18
  97: tokio::runtime::task::UnownedTask<S>::run
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/task/mod.rs:384:9
  98: tokio::runtime::blocking::pool::Task::run
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/blocking/pool.rs:91:9
  99: tokio::runtime::blocking::pool::Inner::run
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/blocking/pool.rs:308:17
 100: tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}}
             at /home/taichong/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/tokio-1.17.0/src/runtime/blocking/pool.rs:288:17
 101: std::sys_common::backtrace::__rust_begin_short_backtrace
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/sys_common/backtrace.rs:122:18
 102: std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/thread/mod.rs:498:17
 103: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/panic/unwind_safe.rs:271:9
 104: std::panicking::try::do_call
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panicking.rs:492:40
 105: __rust_try
 106: std::panicking::try
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panicking.rs:456:19
 107: std::panic::catch_unwind
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/panic.rs:137:14
 108: std::thread::Builder::spawn_unchecked_::{{closure}}
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/thread/mod.rs:497:30
 109: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/core/src/ops/function.rs:227:5
 110: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/alloc/src/boxed.rs:1861:9
      <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/alloc/src/boxed.rs:1861:9
      std::sys::unix::thread::Thread::new::thread_start
             at /rustc/76d770ac21d9521db6a92a48c7b3d5b2cc535941/library/std/src/sys/unix/thread.rs:108:17
 111: start_thread
             at /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477:8
 112: clone

@TCeason TCeason added the C-feature Category: feature label Apr 24, 2022
@TCeason TCeason self-assigned this Apr 24, 2022
@DCjanus
Copy link
Contributor

DCjanus commented Apr 29, 2022

Hi, I've test those functions in different database, here is the output

MariaDB [(none)]> select user();
+-------------------+
| user()            |
+-------------------+
| dcjanus@localhost |
+-------------------+
clickhouse :) select user();

SELECT user()

Query id: 51724423-8cf5-43c4-8ffc-ee5f2a5b3902

┌─currentUser()─┐
│ default       │
└───────────────┘

1 rows in set. Elapsed: 0.001 sec.

As above, in MariaDB and Clickhouse, function user with different value would be given: username only and username with host, some tools may rely on this.

I've not found a way to implement different functions in same name for different protocol, is there any suggestion?

@TCeason
Copy link
Collaborator Author

TCeason commented Apr 29, 2022

Just because the clickhouse user not has host column in users table. We need impl user function like MySQL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: feature
Projects
Development

Successfully merging a pull request may close this issue.

2 participants