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

RW data type conversion to Postgres should respect the original PG data type #16366

Closed
yuhao-su opened this issue Apr 17, 2024 · 0 comments · Fixed by #16589
Closed

RW data type conversion to Postgres should respect the original PG data type #16366

yuhao-su opened this issue Apr 17, 2024 · 0 comments · Fixed by #16589
Assignees
Milestone

Comments

@yuhao-su
Copy link
Contributor

yuhao-su commented Apr 17, 2024

RisingWave doesn't have exactly the same data type as PG. Some PG data types like uuid was converted to RW type varchar. It usually works well when we ingest data from PG.

But in some cases the data stored in RW will be converted to PG type and applied to the PG data source. One example is when backfilling, start_pk_row is originated from PG (e.g. uuid) but converted to RW varchar. When converting the RW varchar back to use as a SQL param, we will get this incorrect binary data format in bind parameter 1

let sql = if start_pk_row.is_none() {
format!(
"SELECT {} FROM {} ORDER BY {} LIMIT {limit}",
self.field_names,
self.get_normalized_table_name(&table_name),
order_key,
)
} else {
let filter_expr = Self::filter_expression(&primary_keys);
format!(
"SELECT {} FROM {} WHERE {} ORDER BY {} LIMIT {limit}",
self.field_names,
self.get_normalized_table_name(&table_name),
filter_expr,
order_key,
)
};
let client = self.client.lock().await;
client.execute("set time zone '+00:00'", &[]).await?;
let params: Vec<DatumRef<'_>> = match start_pk_row {
Some(ref pk_row) => pk_row.iter().collect_vec(),
None => Vec::new(),
};
let stream = client.query_raw(&sql, &params).await?;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants