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

ZomboDB requires AnyElement to retain an embedded OID #695

Closed
workingjubilee opened this issue Sep 19, 2022 · 1 comment
Closed

ZomboDB requires AnyElement to retain an embedded OID #695

workingjubilee opened this issue Sep 19, 2022 · 1 comment

Comments

@workingjubilee
Copy link
Member

This operator is a fundamental comparator in ZomboDB:

#[pg_extern(immutable, parallel_safe)]
fn anyelement_cmpfunc(
    element: AnyElement,
    query: ZDBQuery,
    fcinfo: pg_sys::FunctionCallInfo,
) -> bool {
    let (query_desc, query_state) = match get_executor_manager().peek_query_state() {
        Some((query_desc, query_state)) => (query_desc, query_state),
        None => return false,
    };
    let index_oid = match query_state.lookup_index_for_first_field(*query_desc, fcinfo) {
        Some(oid) => oid,
        None => return false,
    };

    let tid = if element.oid() == pg_sys::TIDOID {
        // use the ItemPointerData passed into us as the first argument
        Some(item_pointer_to_u64(
            unsafe { pg_sys::ItemPointerData::from_datum(element.datum(), element.oid()) }
                .unwrap(),
        ))
    } else {
        panic!(
            "The '==>' operator could not find a \"USING zombodb\" index that matches the left-hand-side of the expression"
        );
    };

    match tid {
        Some(tid) => unsafe {
            pg_func_extra(fcinfo, || do_seqscan(query, index_oid)).contains(&tid)
        },
        None => false,
    }
}

This was broken by #532.

@workingjubilee
Copy link
Member Author

This was fixed by #615 being merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant