Skip to content

Commit

Permalink
Add typemod to Column (paradedb#2)
Browse files Browse the repository at this point in the history
* Add typemod to Column

* small change
  • Loading branch information
rebasedming authored and Weijun-H committed Aug 23, 2024
1 parent 317e8ef commit ee86506
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions supabase-wrappers/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,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 _, 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

0 comments on commit ee86506

Please sign in to comment.