Skip to content

Commit

Permalink
PostgreSQL: lp_flags format
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Safonov committed Aug 1, 2022
1 parent 3c6ea87 commit 850dc60
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions format/postgres/common/pgheap.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import (

const (
HeapPageSize = 8192

LP_UNUSED = 0 /* unused (should always have lp_len=0) */
LP_NORMAL = 1 /* used (should always have lp_len>0) */
LP_REDIRECT = 2 /* HOT redirect (should have lp_len=0) */
LP_DEAD = 3
)

type lpOffMapper struct{}
Expand All @@ -23,6 +28,16 @@ type lpFlagsMapper struct{}
func (m lpFlagsMapper) MapScalar(s scalar.S) (scalar.S, error) {
v := (s.ActualU() >> 15) & 0x3
s.Actual = v
switch v {
case LP_UNUSED:
s.Sym = "LP_UNUSED"
case LP_NORMAL:
s.Sym = "LP_NORMAL"
case LP_REDIRECT:
s.Sym = "LP_REDIRECT"
case LP_DEAD:
s.Sym = "LP_DEAD"
}
return s, nil
}

Expand Down

0 comments on commit 850dc60

Please sign in to comment.