-
Notifications
You must be signed in to change notification settings - Fork 600
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
feat: support current_schema and session_user #4358
Changes from 7 commits
ed85610
54b4b8f
4434ca1
bd5075d
f549ff7
2ce5850
db7ac1c
761c3bd
e3cdb64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
query T | ||
SELECT current_schema(); | ||
---- | ||
public | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,8 +250,8 @@ mod tests { | |
use crate::binder::test_utils::mock_binder; | ||
use crate::expr::{Expr, ExprImpl, ExprType, FunctionCall}; | ||
|
||
#[test] | ||
fn test_bind_value() { | ||
#[tokio::test] | ||
async fn test_bind_value() { | ||
Comment on lines
+253
to
+254
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is async tokio test preferred? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's because we use SessionImpl::mock and somehow it uses an async function internally. #[cfg(test)]
pub fn mock_binder() -> Binder {
- mock_binder_with_catalog(Catalog::default(), "".to_string())
+ Binder::new(&SessionImpl::mock())
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting ... It is a runtime error rather than compile time. |
||
use std::str::FromStr; | ||
|
||
use super::*; | ||
|
@@ -337,8 +337,8 @@ mod tests { | |
assert_eq!(expr.return_type(), DataType::Int32); | ||
} | ||
|
||
#[test] | ||
fn test_bind_interval() { | ||
#[tokio::test] | ||
async fn test_bind_interval() { | ||
use super::*; | ||
|
||
let mut binder = mock_binder(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This file is automatically generated. See `src/frontend/test_runner/README.md` for more information. | ||
- sql: | | ||
select current_schema(); | ||
batch_plan: | | ||
BatchProject { exprs: ['public':Varchar] } | ||
BatchValues { rows: [[]] } | ||
- sql: | | ||
select session_user; | ||
batch_plan: | | ||
BatchProject { exprs: ['root':Varchar] } | ||
BatchValues { rows: [[]] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also
current_schema
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to unsupport it until we really need to use it :) Postgres has so many features that nobody knows whether it will be used one day.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just want to add a second example so this
.iter().any()
reads less confusing. I was wondering why not just"session_user" == ident.xxx
until I realized it can extend to support other "parentheses-less functions".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, let me fix it 😄