Skip to content
/ fq Public
forked from wader/fq

Commit 7a89234

Browse files
author
Pavel Safonov
committed
postgres: update doc
1 parent f6f8d5c commit 7a89234

File tree

3 files changed

+1006
-867
lines changed

3 files changed

+1006
-867
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ pcapng,
125125
[pg_btree](doc/formats.md#pg_btree),
126126
[pg_control](doc/formats.md#pg_control),
127127
[pg_heap](doc/formats.md#pg_heap),
128-
[pg_wal](doc/formats.md#pg_wal),
129128
png,
130129
prores_frame,
131130
[protobuf](doc/formats.md#protobuf),

doc/formats.md

Lines changed: 123 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@
9292
|`opus_packet` |Opus&nbsp;packet |<sub>`vorbis_comment`</sub>|
9393
|[`pcap`](#pcap) |PCAP&nbsp;packet&nbsp;capture |<sub>`link_frame` `tcp_stream` `ipv4_packet`</sub>|
9494
|`pcapng` |PCAPNG&nbsp;packet&nbsp;capture |<sub>`link_frame` `tcp_stream` `ipv4_packet`</sub>|
95+
|[`pg_btree`](#pg_btree) |PostgreSQL&nbsp;btree&nbsp;index&nbsp;file |<sub></sub>|
96+
|[`pg_control`](#pg_control) |PostgreSQL&nbsp;control&nbsp;file |<sub></sub>|
97+
|[`pg_heap`](#pg_heap) |PostgreSQL&nbsp;heap&nbsp;file |<sub></sub>|
9598
|`png` |Portable&nbsp;Network&nbsp;Graphics&nbsp;file |<sub>`icc_profile` `exif`</sub>|
9699
|`prores_frame` |Apple&nbsp;ProRes&nbsp;frame |<sub></sub>|
97100
|[`protobuf`](#protobuf) |Protobuf |<sub></sub>|
@@ -434,7 +437,7 @@ bplist> from_ns_keyed_archiver(1)
434437

435438
## bson
436439

437-
### Limitations:
440+
### Limitations
438441

439442
- The decimal128 type is not supported for decoding, will just be treated as binary
440443

@@ -450,6 +453,10 @@ $ fq -d bson torepr file.bson
450453
$ fq -d bson 'torepr | select(.name=="bob")' file.bson
451454
```
452455

456+
### Authors
457+
- Mattias Wadman mattias.wadman@gmail.com, original author
458+
- Matt Dale [@matthewdale](https://github.com/matthewdale), additional types and bug fixes
459+
453460
### References
454461
- https://bsonspec.org/spec.html
455462

@@ -821,6 +828,121 @@ $ fq '.tcp_connections | group_by(.client.ip) | map({key: .[0].client.ip, value:
821828
"10.99.12.150": 218
822829
}
823830
```
831+
## pg_btree
832+
833+
### Options
834+
835+
|Name |Default|Description|
836+
|- |- |-|
837+
|`page`|0 |First page number in file, default is 0|
838+
839+
### Examples
840+
841+
Decode file using pg_btree options
842+
```
843+
$ fq -d pg_btree -o page=0 . file
844+
```
845+
846+
Decode value as pg_btree
847+
```
848+
... | pg_btree({page:0})
849+
```
850+
851+
### Btree index meta page
852+
853+
```sh
854+
$ fq -d pg_btree -o flavour=postgres14 ".[0] | d" 16404
855+
```
856+
857+
### Btree index page
858+
859+
```sh
860+
$ fq -d pg_btree -o flavour=postgres14 ".[1]" 16404
861+
```
862+
863+
### References
864+
- https://www.postgresql.org/docs/current/storage-page-layout.html
865+
## pg_control
866+
867+
### Options
868+
869+
|Name |Default|Description|
870+
|- |- |-|
871+
|`flavour`| |PostgreSQL flavour: postgres14, pgproee14.., postgres10|
872+
873+
### Examples
874+
875+
Decode file using pg_control options
876+
```
877+
$ fq -d pg_control -o flavour="" . file
878+
```
879+
880+
Decode value as pg_control
881+
```
882+
... | pg_control({flavour:""})
883+
```
884+
885+
### Decode content of pg_control file
886+
887+
```sh
888+
$ fq -d pg_control -o flavour=postgres14 d pg_control
889+
```
890+
891+
### Specific fields can be got by request
892+
893+
```sh
894+
$ fq -d pg_control -o flavour=postgres14 ".state, .check_point_copy.redo, .wal_level" pg_control
895+
```
896+
897+
### References
898+
- https://github.com/postgres/postgres/blob/REL_14_2/src/include/catalog/pg_control.h
899+
## pg_heap
900+
901+
### Options
902+
903+
|Name |Default |Description|
904+
|- |- |-|
905+
|`flavour`|postgres14|PostgreSQL flavour: postgres14, pgproee14.., postgres10|
906+
|`page` |0 |First page number in file, default is 0|
907+
|`segment`|0 |Segment file number (16790.1 is 1), default is 0|
908+
909+
### Examples
910+
911+
Decode file using pg_heap options
912+
```
913+
$ fq -d pg_heap -o flavour="postgres14" -o page=0 -o segment=0 . file
914+
```
915+
916+
Decode value as pg_heap
917+
```
918+
... | pg_heap({flavour:"postgres14",page:0,segment:0})
919+
```
920+
921+
### To see heap page's content
922+
```sh
923+
$ fq -d pg_heap -o flavour=postgres14 ".[0]" 16994
924+
```
925+
926+
### To see page's header
927+
928+
```sh
929+
$ fq -d pg_heap -o flavour=postgres14 ".[0].page_header" 16994
930+
```
931+
932+
### First and last item pointers on first page
933+
934+
```sh
935+
$ fq -d pg_heap -o flavour=postgres14 ".[0].pd_linp[0, -1]" 16994
936+
```
937+
938+
### First and last tuple on first page
939+
940+
```sh
941+
$ fq -d pg_heap -o flavour=postgres14 ".[0].tuples[0, -1]" 16994
942+
```
943+
944+
### References
945+
- https://www.postgresql.org/docs/current/storage-page-layout.html
824946
## protobuf
825947

826948
### Can decode sub messages

0 commit comments

Comments
 (0)