Skip to content

Use references in heap tuple helpers - #2367

Open
0xPoe wants to merge 1 commit into
pgcentralfoundation:developfrom
0xPoe:refactor-htup-raw-pointers
Open

Use references in heap tuple helpers#2367
0xPoe wants to merge 1 commit into
pgcentralfoundation:developfrom
0xPoe:refactor-htup-raw-pointers

Conversation

@0xPoe

@0xPoe 0xPoe commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Replace raw heap tuple pointer parameters with references, using NonNull at the FFI boundary. Clarify the affected safety contracts.

Testing

  • cargo fmt --all -- --check
  • cargo test -p pgrx --no-default-features --features pg18

Refs #623

@0xPoe 0xPoe left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔢 Self-check (PR reviewed by myself and ready for feedback)

  • Code compiles successfully

  • Unit tests added

  • No AI-generated elegant nonsense in PR.

  • Comments added where necessary

  • PR title and description updated

  • PR size is reasonable

/cc @workingjubilee Not sure if you’re still available to review it. Thanks!

Comment thread pgrx/src/htup.rs
pub unsafe fn heap_tuple_header_get_type_id(
htup_header: &pg_sys::HeapTupleHeaderData,
) -> pg_sys::Oid {
unsafe { htup_header.t_choice.t_datum.datum_typeid }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether we prefer to allow unsafe-op-in-unsafe-fn. I’m happy to change it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw the lint configuration, but I’m not sure whether we prefer not to use it at all or simply want to avoid too many noisy warnings.

@0xPoe
0xPoe force-pushed the refactor-htup-raw-pointers branch from 38c7d88 to 8a20aa5 Compare August 28, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant