Skip to content

Commit

Permalink
PostgreSQL: add heap for pgpro14
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Safonov committed Aug 5, 2022
1 parent a653710 commit ffc08cf
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
62 changes: 62 additions & 0 deletions format/postgres/flavours/pgpro14/pgheap.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package pgpro14

import (
"github.com/wader/fq/format/postgres/common"
"github.com/wader/fq/format/postgres/flavours/postgres14/common14"
"github.com/wader/fq/pkg/decode"
)

// type = struct PageHeaderData {
/* 0 | 8 */ // PageXLogRecPtr pd_lsn;
/* 8 | 2 */ // uint16 pd_checksum;
/* 10 | 2 */ // uint16 pd_flags;
/* 12 | 2 */ // LocationIndex pd_lower;
/* 14 | 2 */ // LocationIndex pd_upper;
/* 16 | 2 */ // LocationIndex pd_special;
/* 18 | 2 */ // uint16 pd_pagesize_version;
/* 20 | 4 */ // TransactionId pd_prune_xid;
/* 24 | 0 */ // ItemIdData pd_linp[];
//
/* total size (bytes): 24 */

// type = struct HeapTupleHeaderData {
/* 0 | 12 */ // union {
/* 12 */ // HeapTupleFields t_heap;
/* 12 */ // DatumTupleFields t_datum;
// } t_choice
/* total size (bytes): 12 */
//
/* 12 | 6 */ // ItemPointerData t_ctid
/* 18 | 2 */ // uint16 t_infomask2
/* 20 | 2 */ // uint16 t_infomask
/* 22 | 1 */ // uint8 t_hoff
/* 23 | 0 */ // bits8 t_bits[]
/* XXX 1-byte padding */
//
/* total size (bytes): 24 */

// type = struct HeapTupleFields {
/* 0 | 4 */ // TransactionId t_xmin;
/* 4 | 4 */ // TransactionId t_xmax;
/* 8 | 4 */ // union {
/* 4 */ // CommandId t_cid;
/* 4 */ // TransactionId t_xvac;
// } t_field3;
/* total size (bytes): 4 */
//
/* total size (bytes): 12 */

// type = struct DatumTupleFields {
/* 0 | 4 */ // int32 datum_len_;
/* 4 | 4 */ // int32 datum_typmod;
/* 8 | 4 */ // Oid datum_typeid;
//
/* total size (bytes): 12 */

func DecodeHeap(d *decode.D) any {
heap := &common14.HeapD{
PageSize: common.HeapPageSize,
DecodePageHeaderDataFn: common14.DecodePageHeaderData,
}
return common14.DecodeHeap(d, heap)
}
3 changes: 3 additions & 0 deletions format/postgres/pgheap.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package postgres

import (
"github.com/wader/fq/format"
"github.com/wader/fq/format/postgres/flavours/pgpro14"
"github.com/wader/fq/format/postgres/flavours/pgproee11"
"github.com/wader/fq/format/postgres/flavours/pgproee12"
"github.com/wader/fq/format/postgres/flavours/pgproee14"
Expand Down Expand Up @@ -41,6 +42,8 @@ func decodePgheap(d *decode.D, in any) any {
return pgproee11.DecodeHeap(d)
case PG_FLAVOUR_PGPROEE12:
return pgproee12.DecodeHeap(d)
case PG_FLAVOUR_PGPRO14:
return pgpro14.DecodeHeap(d)
case PG_FLAVOUR_PGPROEE14:
return pgproee14.DecodeHeap(d)
default:
Expand Down

0 comments on commit ffc08cf

Please sign in to comment.