pgrx icon indicating copy to clipboard operation
pgrx copied to clipboard

RFC: Improved `HeapTuple` support

Open Hoverbear opened this issue 3 years ago • 2 comments
trafficstars

Right now we have basic support for HeapTuple, but we'd like to expand on it.

Currently these types are quite basic:

https://github.com/tcdi/pgx/blob/a96c1b75380cfda210029bc4671b342c4e904fe7/pgx/src/spi.rs#L69-L79

We'd like to be able to look up attributes via an ordinal index, or via attribute name.

This is partially to eventually support triggers (which OLD and NEW are heaptuples).

We'd like it for there to be a way to (without causing unnecessary copies) view the data inside these heaptuples, as well as bindings to their internal postgres counterparts which could mutate and/or create these heaptuples.

It may be that we need to distinct types, but we'd like to explore having one common type.

Hoverbear avatar Mar 23 '22 22:03 Hoverbear

See #326

Yes, this would be very helpful. The zero-copy goal is also important. I would probably not use an implementation that merely copied a HeapTuple into a Map except in cases where performance did not matter.

ccleve avatar Mar 30 '22 15:03 ccleve

This is in the develop-v0.5.0 branch

Hoverbear avatar May 31 '22 21:05 Hoverbear