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

fix: pg13 #63

Merged
merged 1 commit into from
Nov 11, 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
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ path = "./src/bin/pgrx_embed.rs"

[features]
default = []
pg12 = ["pgrx/pg12"]
pg13 = ["pgrx/pg13"]
pg14 = ["pgrx/pg14"]
pg15 = ["pgrx/pg15"]
Expand Down
2 changes: 1 addition & 1 deletion src/gucs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub unsafe fn init() {
executing::init();
prewarm::init();
prewarm::prewarm();
#[cfg(any(feature = "pg12", feature = "pg13", feature = "pg14"))]
#[cfg(any(feature = "pg13", feature = "pg14"))]
pgrx::pg_sys::EmitWarningsOnPlaceholders(c"rabbithole".as_ptr());
#[cfg(any(feature = "pg15", feature = "pg16", feature = "pg17"))]
pgrx::pg_sys::MarkGUCPrefixReserved(c"rabbithole".as_ptr());
Expand Down
33 changes: 33 additions & 0 deletions src/index/am.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,39 @@ pub unsafe extern "C" fn ambuildempty(_index: pgrx::pg_sys::Relation) {
pgrx::error!("Unlogged indexes are not supported.");
}

#[cfg(feature = "pg13")]
#[pgrx::pg_guard]
pub unsafe extern "C" fn aminsert(
index: pgrx::pg_sys::Relation,
values: *mut Datum,
is_null: *mut bool,
heap_tid: pgrx::pg_sys::ItemPointer,
_heap: pgrx::pg_sys::Relation,
_check_unique: pgrx::pg_sys::IndexUniqueCheck::Type,
_index_info: *mut pgrx::pg_sys::IndexInfo,
) -> bool {
use base::vector::OwnedVector;
let opfamily = unsafe { am_options::opfamily(index) };
let vector = unsafe { opfamily.datum_to_vector(*values.add(0), *is_null.add(0)) };
if let Some(vector) = vector {
let vector = match opfamily.preprocess(vector.as_borrowed()) {
OwnedVector::Vecf32(x) => x,
OwnedVector::Vecf16(_) => unreachable!(),
OwnedVector::SVecf32(_) => unreachable!(),
OwnedVector::BVector(_) => unreachable!(),
};
let pointer = ctid_to_pointer(unsafe { heap_tid.read() });
algorithm::insert::insert(
unsafe { Relation::new(index) },
pointer,
vector.into_vec(),
opfamily.distance_kind(),
);
}
false
}

#[cfg(any(feature = "pg14", feature = "pg15", feature = "pg16", feature = "pg17"))]
#[pgrx::pg_guard]
pub unsafe extern "C" fn aminsert(
index: pgrx::pg_sys::Relation,
Expand Down
Loading