-
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4358 +/- ##
==========================================
+ Coverage 74.55% 74.56% +0.01%
==========================================
Files 847 847
Lines 123720 123716 -4
==========================================
+ Hits 92242 92253 +11
+ Misses 31478 31463 -15
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
src/frontend/src/binder/expr/mod.rs
Outdated
@@ -41,7 +41,19 @@ impl Binder { | |||
} | |||
Expr::Row(exprs) => self.bind_row(exprs), | |||
// input ref | |||
Expr::Identifier(ident) => self.bind_column(&[ident]), | |||
Expr::Identifier(ident) => { | |||
if ["session_user"] |
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 😄
#[tokio::test] | ||
async fn test_bind_value() { |
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.
Why is async tokio test preferred?
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting ... It is a runtime error rather than compile time.
* feat: support current_schema and session_user * fix * fix test * fix clippy * remove session user test * add second system var Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
I hereby agree to the terms of the Singularity Data, Inc. Contributor License Agreement.
What's changed and what's your intention?
PLEASE DO NOT LEAVE THIS EMPTY !!!
Support two functions that DBeaver uses.
Checklist
./risedev check
(or alias,./risedev c
)Documentation
If your pull request contains user-facing changes, please specify the types of the changes, and create a release note. Otherwise, please feel free to remove this section.
Types of user-facing changes
current_schema
|current_schema()
: Returns the current schema. This is the schema that will be used for any tables or other named objects that are created without specifying a target schema.session_user
: Returns the session user's name.Release note
Please create a release note for your changes. In the release note, focus on the impact on users, and mention the environment or conditions where the impact may occur.
Refer to a related PR or issue link (optional)