-
Notifications
You must be signed in to change notification settings - Fork 333
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
Support printing postgresql's bytea
data type in its "hex" and "escape" format
#3438
Comments
Hello, I would like to help with this issue and #3442. |
@J0HN50N133 Thanks, feel free to take them and ask any questions! |
I've just read some related code. I think one reasonable choice to save the configuration is the |
@J0HN50N133 Since it's pg only, I think a more suitable place for it is |
I guest
|
Yes, the |
After reading more codes, I think it's more reasonable to just use |
|
|
// src/session/src/context.rs
pub struct ParameterConfiguration {
// The name of the parameter should be constant
param_name: &'static str,
value: Value,
}
pub struct QueryContext {
...
// The configuration parameters are used to store the parameters that are set by the user
#[builder(default)]
configuration_parameters: Option<ParameterConfiguration>,
}
// context.rs
impl QueryContext {
pub fn update_session(&self, session: Session) {
...
}
}
// src/operator/src/statement.rs
fn set_configuration_parameters(exprs: Vec<Expr>, ctx: QueryContextRef) -> Result<()>{
... // just set the configuration_parameters field in ctx here
}
// src/session/src/lib.rs
pub struct Session{
...
configuration_parameters: DashMap<&'static str, Value> // parameter name -> parameter value
}
impl Session {
fn set_configuration_parameters(param: ParameterConfiguration){
match self.conn_info.channel {
Postgres => { /*invoke update function writen in postgres.rs*/ }
Mysql => todo!()
}
}
} Here's what I'm going to do to support both |
Looking forward to your PR! |
Sorry, just saw this. Sure we can use metadata to store postgres specific session variables. |
What problem does the new feature solve?
The
bytea
data type is the binary data type in pg. When we "select" it in GreptimeDB, the output is the raw byte string:The inserted value is a hex string "616263", which is "abc" in ascii.
In pg, however, that binary value can be outputted as different formats:
What does the feature do?
The pg has a
SET bytea_output
client configuration to set the output format of the binary value. We could support that as well to offer better usage experience for pg users. The details can be found here.Implementation challenges
servers
. That means the actual "set" impl shouldn't be placed in our general stmt executor. However, currently there're none places in the pg related mods that can handle "set"s. This is the first problem to solve.The text was updated successfully, but these errors were encountered: