Skip to content

Commit

Permalink
Merge pull request #196 from packysauce/main
Browse files Browse the repository at this point in the history
Update pgrx deps to 0.11.0
  • Loading branch information
imor authored Nov 22, 2023
2 parents 079922e + 6d9d7dc commit 77d1aff
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
extension_name:
- wrappers
pgrx_version:
- 0.10.2
- 0.11.0
postgres: [14, 15, 16]
features:
- "all_fdws"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_supabase_wrappers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ jobs:
postgresql-server-dev-15
sudo chmod a+rwx `/usr/lib/postgresql/15/bin/pg_config --pkglibdir` `/usr/lib/postgresql/15/bin/pg_config --sharedir`/extension /var/run/postgresql/
- run: cargo install cargo-pgrx --version 0.10.2
- run: cargo install cargo-pgrx --version 0.11.0
- run: cargo pgrx init --pg15 /usr/lib/postgresql/15/bin/pg_config
- run: cd supabase-wrappers && cargo test
2 changes: 1 addition & 1 deletion .github/workflows/test_wrappers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ jobs:
postgresql-server-dev-15
sudo chmod a+rwx `/usr/lib/postgresql/15/bin/pg_config --pkglibdir` `/usr/lib/postgresql/15/bin/pg_config --sharedir`/extension /var/run/postgresql/
- run: cargo install cargo-pgrx --version 0.10.2
- run: cargo install cargo-pgrx --version 0.11.0
- run: cargo pgrx init --pg15 /usr/lib/postgresql/15/bin/pg_config
- run: cd wrappers && cargo pgrx test --features all_fdws,pg15
4 changes: 2 additions & 2 deletions supabase-wrappers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ pg16 = ["pgrx/pg16", "pgrx-tests/pg16"]
pg_test = []

[dependencies]
pgrx = { version = "=0.10.2", default-features = false }
pgrx = { version = "=0.11.0", default-features = false }
thiserror = "1.0.48"
tokio = { version = "1.24", features = ["rt"] }
uuid = { version = "1.2.2" }
supabase-wrappers-macros = { version = "0.1", path = "../supabase-wrappers-macros" }

[dev-dependencies]
pgrx-tests = "=0.10.2"
pgrx-tests = "=0.11.0"

[package.metadata.docs.rs]
features = ["pg15", "cshim"]
Expand Down
2 changes: 1 addition & 1 deletion supabase-wrappers/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ pub trait ForeignDataWrapper<E: Into<ErrorReport>> {
unsafe {
use crate::{modify, scan};
let mut fdw_routine =
FdwRoutine::<AllocatedByRust>::alloc_node(pg_sys::NodeTag_T_FdwRoutine);
FdwRoutine::<AllocatedByRust>::alloc_node(pg_sys::NodeTag::T_FdwRoutine);

// plan phase
fdw_routine.GetForeignRelSize = Some(scan::get_foreign_rel_size::<E, Self>);
Expand Down
4 changes: 2 additions & 2 deletions supabase-wrappers/src/limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub(crate) unsafe fn extract_limit(

// only push down constant LIMITs that are not NULL
let limit_count = (*parse).limitCount as *mut pg_sys::Const;
if limit_count.is_null() || !is_a(limit_count as *mut pg_sys::Node, pg_sys::NodeTag_T_Const) {
if limit_count.is_null() || !is_a(limit_count as *mut pg_sys::Node, pg_sys::NodeTag::T_Const) {
return None;
}

Expand All @@ -34,7 +34,7 @@ pub(crate) unsafe fn extract_limit(

// only consider OFFSETS that are non-NULL constants
let limit_offset = (*parse).limitOffset as *mut pg_sys::Const;
if !limit_offset.is_null() && is_a(limit_offset as *mut pg_sys::Node, pg_sys::NodeTag_T_Const) {
if !limit_offset.is_null() && is_a(limit_offset as *mut pg_sys::Node, pg_sys::NodeTag::T_Const) {
if let Some(offset) = i64::from_polymorphic_datum(
(*limit_offset).constvalue,
(*limit_offset).constisnull,
Expand Down
28 changes: 14 additions & 14 deletions supabase-wrappers/src/qual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ pub(crate) unsafe fn get_operator(opno: pg_sys::Oid) -> pg_sys::Form_pg_operator
}

pub(crate) unsafe fn unnest_clause(node: *mut pg_sys::Node) -> *mut pg_sys::Node {
if is_a(node, pg_sys::NodeTag_T_RelabelType) {
if is_a(node, pg_sys::NodeTag::T_RelabelType) {
(*(node as *mut pg_sys::RelabelType)).arg as _
} else if is_a(node, pg_sys::NodeTag_T_ArrayCoerceExpr) {
} else if is_a(node, pg_sys::NodeTag::T_ArrayCoerceExpr) {
(*(node as *mut pg_sys::ArrayCoerceExpr)).arg as _
} else {
node
Expand Down Expand Up @@ -105,20 +105,20 @@ pub(crate) unsafe fn extract_from_op_expr(
let mut right = unnest_clause(args.tail().unwrap());

// swap operands if needed
if is_a(right, pg_sys::NodeTag_T_Var)
&& !is_a(left, pg_sys::NodeTag_T_Var)
if is_a(right, pg_sys::NodeTag::T_Var)
&& !is_a(left, pg_sys::NodeTag::T_Var)
&& (*opr).oprcom != Oid::INVALID
{
std::mem::swap(&mut left, &mut right);
}

if is_a(left, pg_sys::NodeTag_T_Var) {
if is_a(left, pg_sys::NodeTag::T_Var) {
let left = left as *mut pg_sys::Var;

if pg_sys::bms_is_member((*left).varno as c_int, baserel_ids) && (*left).varattno >= 1 {
let field = pg_sys::get_attname(baserel_id, (*left).varattno, false);

let (value, param) = if is_a(right, pg_sys::NodeTag_T_Const) {
let (value, param) = if is_a(right, pg_sys::NodeTag::T_Const) {
let right = right as *mut pg_sys::Const;
(
Cell::from_polymorphic_datum(
Expand All @@ -128,7 +128,7 @@ pub(crate) unsafe fn extract_from_op_expr(
),
None,
)
} else if is_a(right, pg_sys::NodeTag_T_Param) {
} else if is_a(right, pg_sys::NodeTag::T_Param) {
// add a dummy value if this is query parameter, the actual value
// will be extracted from execution state
let right = right as *mut pg_sys::Param;
Expand Down Expand Up @@ -166,7 +166,7 @@ pub(crate) unsafe fn extract_from_null_test(
expr: *mut pg_sys::NullTest,
) -> Option<Qual> {
let var = (*expr).arg as *mut pg_sys::Var;
if !is_a(var as _, pg_sys::NodeTag_T_Var) || (*var).varattno < 1 {
if !is_a(var as _, pg_sys::NodeTag::T_Var) || (*var).varattno < 1 {
return None;
}

Expand Down Expand Up @@ -212,7 +212,7 @@ pub(crate) unsafe fn extract_from_scalar_array_op_expr(
let left = unnest_clause(args.head().unwrap());
let right = unnest_clause(args.tail().unwrap());

if is_a(left, pg_sys::NodeTag_T_Var) && is_a(right, pg_sys::NodeTag_T_Const) {
if is_a(left, pg_sys::NodeTag::T_Var) && is_a(right, pg_sys::NodeTag::T_Const) {
let left = left as *mut pg_sys::Var;
let right = right as *mut pg_sys::Const;

Expand Down Expand Up @@ -313,15 +313,15 @@ pub(crate) unsafe fn extract_quals(
let conds = PgList::<pg_sys::RestrictInfo>::from_pg((*baserel).baserestrictinfo);
for cond in conds.iter_ptr() {
let expr = (*cond).clause as *mut pg_sys::Node;
let extracted = if is_a(expr, pg_sys::NodeTag_T_OpExpr) {
let extracted = if is_a(expr, pg_sys::NodeTag::T_OpExpr) {
extract_from_op_expr(root, baserel_id, (*baserel).relids, expr as _)
} else if is_a(expr, pg_sys::NodeTag_T_NullTest) {
} else if is_a(expr, pg_sys::NodeTag::T_NullTest) {
extract_from_null_test(baserel_id, expr as _)
} else if is_a(expr, pg_sys::NodeTag_T_ScalarArrayOpExpr) {
} else if is_a(expr, pg_sys::NodeTag::T_ScalarArrayOpExpr) {
extract_from_scalar_array_op_expr(root, baserel_id, (*baserel).relids, expr as _)
} else if is_a(expr, pg_sys::NodeTag_T_Var) {
} else if is_a(expr, pg_sys::NodeTag::T_Var) {
extract_from_var(root, baserel_id, (*baserel).relids, expr as _)
} else if is_a(expr, pg_sys::NodeTag_T_BoolExpr) {
} else if is_a(expr, pg_sys::NodeTag::T_BoolExpr) {
extract_from_bool_expr(root, baserel_id, (*baserel).relids, expr as _)
} else {
if let Some(stm) = pgrx::nodes::node_to_string(expr) {
Expand Down
6 changes: 3 additions & 3 deletions supabase-wrappers/src/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ pub(crate) unsafe fn extract_sorts(
.and_then(|em| {
let expr = (*em).em_expr as *mut pg_sys::Node;

if is_a(expr, pg_sys::NodeTag_T_Var) {
if is_a(expr, pg_sys::NodeTag::T_Var) {
let var = expr as *mut pg_sys::Var;
let sort = create_sort(pathkey, var, baserel_id);
if let Some(sort) = sort {
ret.push(sort);
}
} else if is_a(expr, pg_sys::NodeTag_T_RelabelType) {
} else if is_a(expr, pg_sys::NodeTag::T_RelabelType) {
// ORDER BY clauses having a COLLATE option will be RelabelType
let expr = expr as *mut pg_sys::RelabelType;
let var = (*expr).arg as *mut pg_sys::Var;
if is_a(var as *mut pg_sys::Node, pg_sys::NodeTag_T_Var) {
if is_a(var as *mut pg_sys::Node, pg_sys::NodeTag::T_Var) {
let sort = create_sort(pathkey, var, baserel_id);
if let Some(mut sort) = sort {
let coll_id = (*expr).resultcollid;
Expand Down
68 changes: 34 additions & 34 deletions wrappers/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions wrappers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ all_fdws = [
]

[dependencies]
pgrx = { version = "=0.10.2" }
pgrx = { version = "=0.11.0" }
#supabase-wrappers = "0.1"
supabase-wrappers = { path = "../supabase-wrappers", default-features = false }

Expand Down Expand Up @@ -146,7 +146,7 @@ arrow-array = { version = "41.0.0", optional = true }
thiserror = { version = "1.0.48", optional = true }

[dev-dependencies]
pgrx-tests = "=0.10.2"
pgrx-tests = "=0.11.0"

[profile.dev]
panic = "unwind"
Expand Down

0 comments on commit 77d1aff

Please sign in to comment.