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

Add typemod to Column #2

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions supabase-wrappers/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ pub struct Column {

/// column type OID, can be used to match pg_sys::BuiltinOid
pub type_oid: Oid,

/// column type mod
pub type_mod: i32,
}

/// A restiction value used in [`Qual`], either a [`Cell`] or an array of [`Cell`]
Expand Down
2 changes: 2 additions & 0 deletions supabase-wrappers/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ pub(super) unsafe fn extract_target_columns(
let rte = pg_sys::planner_rt_fetch((*var).varno as u32, root);
let attno = (*var).varattno;
let attname = pg_sys::get_attname((*rte).relid, attno, true);
let type_mod = (*var).vartypmod;
if !attname.is_null() {
// generated column is not supported
if pg_sys::get_attgenerated((*rte).relid, attno) > 0 {
Expand All @@ -258,6 +259,7 @@ pub(super) unsafe fn extract_target_columns(
name: CStr::from_ptr(attname).to_str().unwrap().to_owned(),
num: attno as usize,
type_oid,
type_mod,
});
}
}
Expand Down