From aaae3c6bf80eeb60fc7121aff472bc28972c1c7b Mon Sep 17 00:00:00 2001 From: Yoh Deadfall Date: Wed, 4 Dec 2024 00:53:38 +0300 Subject: [PATCH] Implemented DerefMut for PgRelation --- pgrx/src/rel.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pgrx/src/rel.rs b/pgrx/src/rel.rs index 4c4d5517e8..859652d5f2 100644 --- a/pgrx/src/rel.rs +++ b/pgrx/src/rel.rs @@ -14,7 +14,7 @@ use crate::{ use pgrx_sql_entity_graph::metadata::{ ArgumentError, Returns, ReturnsError, SqlMapping, SqlTranslatable, }; -use std::ops::Deref; +use std::ops::{Deref, DerefMut}; use std::os::raw::c_char; pub struct PgRelation { @@ -334,6 +334,12 @@ impl Deref for PgRelation { } } +impl DerefMut for PgRelation { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.boxed + } +} + impl Drop for PgRelation { fn drop(&mut self) { if !self.boxed.is_null() && self.need_close {