Add tid_block() and tid_offset() accessor functions The two new functions allow to extract the block number and offset from a tid.
There are existing ways to do so (e.g. by doing (ctid::text::point)[0]), but they are hard to remember and not pretty. tid_block() returns int8 (bigint) because BlockNumber is uint32, which exceeds the range of int4. tid_offset() returns int4 (integer) because OffsetNumber is uint16, which fits safely in int4. Bumps catversion. Author: Ayush Tiwari <[email protected]> Discussion: https://postgr.es/m/cajtyswuzok2+mvsykbvuwq_swwg-gdhqcuyumn82au97sjw...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/df6949ccf7a6d5160e3068ed843eb46ab7bc2601 Modified Files -------------- doc/src/sgml/func/allfiles.sgml | 1 + doc/src/sgml/func/func-tid.sgml | 70 ++++++++++++++++++++++++++++++++ doc/src/sgml/func/func.sgml | 1 + src/backend/utils/adt/tid.c | 29 +++++++++++++ src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_proc.dat | 6 +++ src/test/regress/expected/opr_sanity.out | 2 + src/test/regress/expected/tid.out | 66 ++++++++++++++++++++++++++++++ src/test/regress/sql/tid.sql | 21 ++++++++++ 9 files changed, 197 insertions(+), 1 deletion(-)
