diff -Nru postgresql-filedump-14.1/debian/changelog postgresql-filedump-16.0/debian/changelog --- postgresql-filedump-14.1/debian/changelog 2023-01-18 23:57:27.000000000 +0000 +++ postgresql-filedump-16.0/debian/changelog 2023-09-14 13:39:53.000000000 +0000 @@ -1,8 +1,11 @@ -postgresql-filedump (14.1-1build1) lunar; urgency=medium +postgresql-filedump (16.0-1) unstable; urgency=medium - * No change rebuild for PostgreSQL 15 + * New upstream version with PG 16 support. + * Install pg_filedump to /usr/bin; drop update-alternatives handling. + * Use debian/tests/installcheck for build-time testing so we see + regression.diffs on failure. - -- Athos Ribeiro Wed, 18 Jan 2023 20:57:27 -0300 + -- Christoph Berg Thu, 14 Sep 2023 15:39:53 +0200 postgresql-filedump (14.1-1) unstable; urgency=medium diff -Nru postgresql-filedump-14.1/debian/control postgresql-filedump-16.0/debian/control --- postgresql-filedump-14.1/debian/control 2023-01-18 23:57:27.000000000 +0000 +++ postgresql-filedump-16.0/debian/control 2023-09-14 09:47:56.000000000 +0000 @@ -1,8 +1,7 @@ Source: postgresql-filedump Section: database Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Debian PostgreSQL Maintainers +Maintainer: Debian PostgreSQL Maintainers Uploaders: Michael Meskes , Christoph Berg , diff -Nru postgresql-filedump-14.1/debian/docs postgresql-filedump-16.0/debian/docs --- postgresql-filedump-14.1/debian/docs 2023-01-18 23:57:26.000000000 +0000 +++ postgresql-filedump-16.0/debian/docs 2023-09-14 13:39:53.000000000 +0000 @@ -1 +1 @@ -README.pg_filedump +README.pg_filedump* diff -Nru postgresql-filedump-14.1/debian/postgresql-filedump.install postgresql-filedump-16.0/debian/postgresql-filedump.install --- postgresql-filedump-14.1/debian/postgresql-filedump.install 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/debian/postgresql-filedump.install 2023-09-14 13:39:53.000000000 +0000 @@ -0,0 +1 @@ +pg_filedump usr/bin diff -Nru postgresql-filedump-14.1/debian/postgresql-filedump.postinst postgresql-filedump-16.0/debian/postgresql-filedump.postinst --- postgresql-filedump-14.1/debian/postgresql-filedump.postinst 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/debian/postgresql-filedump.postinst 2023-09-14 13:39:53.000000000 +0000 @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +case $1 in + configure) + # remove previous hack that linked to /usr/lib/postgresql/*/bin + if dpkg --compare-versions "$2" lt-nl 16.0; then + update-alternatives --remove-all pg_filedump || : + fi + ;; +esac + +#DEBHELPER# diff -Nru postgresql-filedump-14.1/debian/postinst postgresql-filedump-16.0/debian/postinst --- postgresql-filedump-14.1/debian/postinst 2023-01-18 23:57:26.000000000 +0000 +++ postgresql-filedump-16.0/debian/postinst 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -#!/bin/sh - -set -e - -PGBINDIR=/usr/lib/postgresql/14/bin - -case "$1" in - configure) - update-alternatives --quiet --install /usr/bin/pg_filedump pg_filedump $PGBINDIR/pg_filedump 100 - ;; -esac - -#DEBHELPER# diff -Nru postgresql-filedump-14.1/debian/prerm postgresql-filedump-16.0/debian/prerm --- postgresql-filedump-14.1/debian/prerm 2023-01-18 23:57:26.000000000 +0000 +++ postgresql-filedump-16.0/debian/prerm 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -#!/bin/sh - -set -e - -PGBINDIR=/usr/lib/postgresql/14/bin - -case "$1" in - remove|deconfigure) - update-alternatives --quiet --remove pg_filedump $PGBINDIR/pg_filedump - ;; -esac - -#DEBHELPER# - diff -Nru postgresql-filedump-14.1/debian/rules postgresql-filedump-16.0/debian/rules --- postgresql-filedump-14.1/debian/rules 2023-01-18 23:57:26.000000000 +0000 +++ postgresql-filedump-16.0/debian/rules 2023-09-14 13:39:53.000000000 +0000 @@ -10,11 +10,6 @@ $(MAKE) COPT="$(CFLAGS)" override_dh_auto_test: - PATH=$(CURDIR):$(PATH) pg_virtualenv make installcheck + PATH=$(CURDIR):$(PATH) debian/tests/installcheck override_dh_auto_install: - $(MAKE) install DESTDIR=$(CURDIR)/debian/postgresql-filedump - -override_dh_installdeb: - sed -i -e "s!^PGBINDIR=.*!PGBINDIR=$(shell pg_config --bindir)!" debian/postinst debian/prerm - dh_installdeb diff -Nru postgresql-filedump-14.1/decode.c postgresql-filedump-16.0/decode.c --- postgresql-filedump-14.1/decode.c 2022-03-30 13:04:59.000000000 +0000 +++ postgresql-filedump-16.0/decode.c 2023-09-14 13:37:45.000000000 +0000 @@ -67,6 +67,9 @@ decode_int(const char *buffer, unsigned int buff_size, unsigned int *out_size); static int +decode_uint(const char *buffer, unsigned int buff_size, unsigned int *out_size); + +static int decode_bigint(const char *buffer, unsigned int buff_size, unsigned int *out_size); static int @@ -144,10 +147,10 @@ "int", &decode_int }, { - "oid", &decode_int + "oid", &decode_uint }, { - "xid", &decode_int + "xid", &decode_uint }, { "serial", &decode_int @@ -244,6 +247,7 @@ static char decompress_tmp_buff[64 * 1024]; /* Used by some PostgreSQL macro definitions */ +#if PG_VERSION_NUM < 160000 void ExceptionalCondition(const char *conditionName, const char *errorType, @@ -257,6 +261,19 @@ lineNumber); exit(1); } +#else +void +ExceptionalCondition(const char *conditionName, + const char *fileName, + int lineNumber) +{ + printf("Exceptional condition: name = %s, type = FailedAssertion, fname = %s, line = %d\n", + conditionName ? conditionName : "(NULL)", + fileName ? fileName : "(NULL)", + lineNumber); + exit(1); +} +#endif /* Append given string to current COPY line */ static void @@ -688,6 +705,27 @@ return 0; } +/* Decode an unsigned int type */ +static int +decode_uint(const char *buffer, unsigned int buff_size, unsigned int *out_size) +{ + const char *new_buffer = (const char *) INTALIGN(buffer); + unsigned int delta = (unsigned int) ((uintptr_t) new_buffer - (uintptr_t) buffer); + + if (buff_size < delta) + return -1; + + buff_size -= delta; + buffer = new_buffer; + + if (buff_size < sizeof(uint32)) + return -2; + + CopyAppendFmt("%u", *(uint32 *) buffer); + *out_size = sizeof(uint32) + delta; + return 0; +} + /* Decode a bigint type */ static int decode_bigint(const char *buffer, unsigned int buff_size, unsigned int *out_size) @@ -1270,6 +1308,7 @@ #else printf("Error: compression method lz4 not supported.\n"); printf("Try to rebuild pg_filedump for PostgreSQL server of version 14+ with --with-lz4 option.\n"); + free(decompress_tmp_buff); return -2; #endif default: @@ -1350,8 +1389,7 @@ toast_relation_filename); result = -1; } - - if (result == 0) + else { unsigned int toast_relation_block_size = GetBlockSize(toast_rel_fp); fseek(toast_rel_fp, 0, SEEK_SET); @@ -1381,9 +1419,9 @@ } free(toast_data); + fclose(toast_rel_fp); } - fclose(toast_rel_fp); free(toast_relation_path); } /* If tag is indirect or expanded, it was stored in memory. */ diff -Nru postgresql-filedump-14.1/expected/datatypes_3.out postgresql-filedump-16.0/expected/datatypes_3.out --- postgresql-filedump-14.1/expected/datatypes_3.out 2022-03-30 13:04:59.000000000 +0000 +++ postgresql-filedump-16.0/expected/datatypes_3.out 2023-09-14 13:37:45.000000000 +0000 @@ -303,106 +303,6 @@ -- ---------------------------------------------------------------------------------------------- -- -create table float4 (x float4); -insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); -\set relname float4 -\ir run_test.sql -\echo Testing :relname -Testing float4 -vacuum :"relname"; -checkpoint; -select relfilenode from pg_class where relname = :'relname' \gset -select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset -\set output :relname '.heap' -\lo_export :oid :output -\setenv relname :relname -\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" - -******************************************************************* -* PostgreSQL File/Block Formatted Dump Utility -* -* File: float4.heap -* Options used: -D float4 -******************************************************************* - -Block 0 ******************************************************** -
----- - Block Offset: 0x00000000 Offsets: Lower 48 (0x0030) - Block: Size 8192 Version 4 Upper 8028 (0x1f5c) - LSN: logid . recoff 0x........ Special 8192 (0x2000) - Items: 6 Free Space: 7980 - Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) - Length (including item array): 48 - - ----- - Item 1 -- Length: 28 Offset: 8164 (0x1fe4) Flags: NORMAL -COPY: 0.000000000000 - Item 2 -- Length: 28 Offset: 8136 (0x1fc8) Flags: NORMAL -COPY: -0.000000000000 - Item 3 -- Length: 28 Offset: 8108 (0x1fac) Flags: NORMAL -COPY: -Infinity - Item 4 -- Length: 28 Offset: 8080 (0x1f90) Flags: NORMAL -COPY: Infinity - Item 5 -- Length: 28 Offset: 8052 (0x1f74) Flags: NORMAL -COPY: NaN - Item 6 -- Length: 24 Offset: 8028 (0x1f5c) Flags: NORMAL -COPY: \N - - -*** End of File Encountered. Last Block Read: 0 *** --- ----------------------------------------------------------------------------------------------- --- -create table float8 (x float8); -insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); -\set relname float8 -\ir run_test.sql -\echo Testing :relname -Testing float8 -vacuum :"relname"; -checkpoint; -select relfilenode from pg_class where relname = :'relname' \gset -select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset -\set output :relname '.heap' -\lo_export :oid :output -\setenv relname :relname -\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" - -******************************************************************* -* PostgreSQL File/Block Formatted Dump Utility -* -* File: float8.heap -* Options used: -D float8 -******************************************************************* - -Block 0 ******************************************************** -
----- - Block Offset: 0x00000000 Offsets: Lower 48 (0x0030) - Block: Size 8192 Version 4 Upper 8008 (0x1f48) - LSN: logid . recoff 0x........ Special 8192 (0x2000) - Items: 6 Free Space: 7960 - Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) - Length (including item array): 48 - - ----- - Item 1 -- Length: 32 Offset: 8160 (0x1fe0) Flags: NORMAL -COPY: 0.000000000000 - Item 2 -- Length: 32 Offset: 8128 (0x1fc0) Flags: NORMAL -COPY: -0.000000000000 - Item 3 -- Length: 32 Offset: 8096 (0x1fa0) Flags: NORMAL -COPY: -Infinity - Item 4 -- Length: 32 Offset: 8064 (0x1f80) Flags: NORMAL -COPY: Infinity - Item 5 -- Length: 32 Offset: 8032 (0x1f60) Flags: NORMAL -COPY: NaN - Item 6 -- Length: 24 Offset: 8008 (0x1f48) Flags: NORMAL -COPY: \N - - -*** End of File Encountered. Last Block Read: 0 *** --- ----------------------------------------------------------------------------------------------- --- create table int (x int); insert into int values (-1), (0), (1), (null); \set relname int @@ -583,58 +483,6 @@ -- ---------------------------------------------------------------------------------------------- -- -create table numeric (x numeric); -insert into numeric values (0), ('12341234'), ('-567890'), ('-Infinity'), ('Infinity'), ('NaN'), (null); -\set relname numeric -\ir run_test.sql -\echo Testing :relname -Testing numeric -vacuum :"relname"; -checkpoint; -select relfilenode from pg_class where relname = :'relname' \gset -select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset -\set output :relname '.heap' -\lo_export :oid :output -\setenv relname :relname -\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" - -******************************************************************* -* PostgreSQL File/Block Formatted Dump Utility -* -* File: numeric.heap -* Options used: -D numeric -******************************************************************* - -Block 0 ******************************************************** -
----- - Block Offset: 0x00000000 Offsets: Lower 52 (0x0034) - Block: Size 8192 Version 4 Upper 7992 (0x1f38) - LSN: logid . recoff 0x........ Special 8192 (0x2000) - Items: 7 Free Space: 7940 - Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) - Length (including item array): 52 - - ----- - Item 1 -- Length: 27 Offset: 8164 (0x1fe4) Flags: NORMAL -COPY: 0 - Item 2 -- Length: 31 Offset: 8132 (0x1fc4) Flags: NORMAL -COPY: 12341234 - Item 3 -- Length: 31 Offset: 8100 (0x1fa4) Flags: NORMAL -COPY: -567890 - Item 4 -- Length: 27 Offset: 8072 (0x1f88) Flags: NORMAL -COPY: -Infinity - Item 5 -- Length: 27 Offset: 8044 (0x1f6c) Flags: NORMAL -COPY: Infinity - Item 6 -- Length: 27 Offset: 8016 (0x1f50) Flags: NORMAL -COPY: NaN - Item 7 -- Length: 24 Offset: 7992 (0x1f38) Flags: NORMAL -COPY: \N - - -*** End of File Encountered. Last Block Read: 0 *** --- ----------------------------------------------------------------------------------------------- --- create table oid (x oid); insert into oid values (-1), (0), (1), (null); \set relname oid @@ -668,7 +516,7 @@ ----- Item 1 -- Length: 28 Offset: 8164 (0x1fe4) Flags: NORMAL -COPY: -1 +COPY: 4294967295 Item 2 -- Length: 28 Offset: 8136 (0x1fc8) Flags: NORMAL COPY: 0 Item 3 -- Length: 28 Offset: 8108 (0x1fac) Flags: NORMAL @@ -1124,7 +972,7 @@ ----- Item 1 -- Length: 28 Offset: 8164 (0x1fe4) Flags: NORMAL -COPY: -1 +COPY: 4294967295 Item 2 -- Length: 28 Offset: 8136 (0x1fc8) Flags: NORMAL COPY: 0 Item 3 -- Length: 28 Offset: 8108 (0x1fac) Flags: NORMAL @@ -1133,48 +981,6 @@ COPY: \N -*** End of File Encountered. Last Block Read: 0 *** --- ----------------------------------------------------------------------------------------------- --- -create table xml (x xml); -insert into xml values (''), (null); -\set relname xml -\ir run_test.sql -\echo Testing :relname -Testing xml -vacuum :"relname"; -checkpoint; -select relfilenode from pg_class where relname = :'relname' \gset -select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset -\set output :relname '.heap' -\lo_export :oid :output -\setenv relname :relname -\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" - -******************************************************************* -* PostgreSQL File/Block Formatted Dump Utility -* -* File: xml.heap -* Options used: -D xml -******************************************************************* - -Block 0 ******************************************************** -
----- - Block Offset: 0x00000000 Offsets: Lower 32 (0x0020) - Block: Size 8192 Version 4 Upper 8132 (0x1fc4) - LSN: logid . recoff 0x........ Special 8192 (0x2000) - Items: 2 Free Space: 8100 - Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) - Length (including item array): 32 - - ----- - Item 1 -- Length: 36 Offset: 8156 (0x1fdc) Flags: NORMAL -COPY: - Item 2 -- Length: 24 Offset: 8132 (0x1fc4) Flags: NORMAL -COPY: \N - - *** End of File Encountered. Last Block Read: 0 *** -- ---------------------------------------------------------------------------------------------- diff -Nru postgresql-filedump-14.1/expected/datatypes.out postgresql-filedump-16.0/expected/datatypes.out --- postgresql-filedump-14.1/expected/datatypes.out 2022-03-30 13:04:59.000000000 +0000 +++ postgresql-filedump-16.0/expected/datatypes.out 2023-09-14 13:37:45.000000000 +0000 @@ -303,106 +303,6 @@ -- ---------------------------------------------------------------------------------------------- -- -create table float4 (x float4); -insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); -\set relname float4 -\ir run_test.sql -\echo Testing :relname -Testing float4 -vacuum :"relname"; -checkpoint; -select relfilenode from pg_class where relname = :'relname' \gset -select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset -\set output :relname '.heap' -\lo_export :oid :output -\setenv relname :relname -\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" - -******************************************************************* -* PostgreSQL File/Block Formatted Dump Utility -* -* File: float4.heap -* Options used: -D float4 -******************************************************************* - -Block 0 ******************************************************** -
----- - Block Offset: 0x00000000 Offsets: Lower 48 (0x0030) - Block: Size 8192 Version 4 Upper 8008 (0x1f48) - LSN: logid . recoff 0x........ Special 8192 (0x2000) - Items: 6 Free Space: 7960 - Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) - Length (including item array): 48 - - ----- - Item 1 -- Length: 28 Offset: 8160 (0x1fe0) Flags: NORMAL -COPY: 0.000000000000 - Item 2 -- Length: 28 Offset: 8128 (0x1fc0) Flags: NORMAL -COPY: -0.000000000000 - Item 3 -- Length: 28 Offset: 8096 (0x1fa0) Flags: NORMAL -COPY: -Infinity - Item 4 -- Length: 28 Offset: 8064 (0x1f80) Flags: NORMAL -COPY: Infinity - Item 5 -- Length: 28 Offset: 8032 (0x1f60) Flags: NORMAL -COPY: NaN - Item 6 -- Length: 24 Offset: 8008 (0x1f48) Flags: NORMAL -COPY: \N - - -*** End of File Encountered. Last Block Read: 0 *** --- ----------------------------------------------------------------------------------------------- --- -create table float8 (x float8); -insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); -\set relname float8 -\ir run_test.sql -\echo Testing :relname -Testing float8 -vacuum :"relname"; -checkpoint; -select relfilenode from pg_class where relname = :'relname' \gset -select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset -\set output :relname '.heap' -\lo_export :oid :output -\setenv relname :relname -\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" - -******************************************************************* -* PostgreSQL File/Block Formatted Dump Utility -* -* File: float8.heap -* Options used: -D float8 -******************************************************************* - -Block 0 ******************************************************** -
----- - Block Offset: 0x00000000 Offsets: Lower 48 (0x0030) - Block: Size 8192 Version 4 Upper 8008 (0x1f48) - LSN: logid . recoff 0x........ Special 8192 (0x2000) - Items: 6 Free Space: 7960 - Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) - Length (including item array): 48 - - ----- - Item 1 -- Length: 32 Offset: 8160 (0x1fe0) Flags: NORMAL -COPY: 0.000000000000 - Item 2 -- Length: 32 Offset: 8128 (0x1fc0) Flags: NORMAL -COPY: -0.000000000000 - Item 3 -- Length: 32 Offset: 8096 (0x1fa0) Flags: NORMAL -COPY: -Infinity - Item 4 -- Length: 32 Offset: 8064 (0x1f80) Flags: NORMAL -COPY: Infinity - Item 5 -- Length: 32 Offset: 8032 (0x1f60) Flags: NORMAL -COPY: NaN - Item 6 -- Length: 24 Offset: 8008 (0x1f48) Flags: NORMAL -COPY: \N - - -*** End of File Encountered. Last Block Read: 0 *** --- ----------------------------------------------------------------------------------------------- --- create table int (x int); insert into int values (-1), (0), (1), (null); \set relname int @@ -583,58 +483,6 @@ -- ---------------------------------------------------------------------------------------------- -- -create table numeric (x numeric); -insert into numeric values (0), ('12341234'), ('-567890'), ('-Infinity'), ('Infinity'), ('NaN'), (null); -\set relname numeric -\ir run_test.sql -\echo Testing :relname -Testing numeric -vacuum :"relname"; -checkpoint; -select relfilenode from pg_class where relname = :'relname' \gset -select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset -\set output :relname '.heap' -\lo_export :oid :output -\setenv relname :relname -\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" - -******************************************************************* -* PostgreSQL File/Block Formatted Dump Utility -* -* File: numeric.heap -* Options used: -D numeric -******************************************************************* - -Block 0 ******************************************************** -
----- - Block Offset: 0x00000000 Offsets: Lower 52 (0x0034) - Block: Size 8192 Version 4 Upper 7976 (0x1f28) - LSN: logid . recoff 0x........ Special 8192 (0x2000) - Items: 7 Free Space: 7924 - Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) - Length (including item array): 52 - - ----- - Item 1 -- Length: 27 Offset: 8160 (0x1fe0) Flags: NORMAL -COPY: 0 - Item 2 -- Length: 31 Offset: 8128 (0x1fc0) Flags: NORMAL -COPY: 12341234 - Item 3 -- Length: 31 Offset: 8096 (0x1fa0) Flags: NORMAL -COPY: -567890 - Item 4 -- Length: 27 Offset: 8064 (0x1f80) Flags: NORMAL -COPY: -Infinity - Item 5 -- Length: 27 Offset: 8032 (0x1f60) Flags: NORMAL -COPY: Infinity - Item 6 -- Length: 27 Offset: 8000 (0x1f40) Flags: NORMAL -COPY: NaN - Item 7 -- Length: 24 Offset: 7976 (0x1f28) Flags: NORMAL -COPY: \N - - -*** End of File Encountered. Last Block Read: 0 *** --- ----------------------------------------------------------------------------------------------- --- create table oid (x oid); insert into oid values (-1), (0), (1), (null); \set relname oid @@ -668,7 +516,7 @@ ----- Item 1 -- Length: 28 Offset: 8160 (0x1fe0) Flags: NORMAL -COPY: -1 +COPY: 4294967295 Item 2 -- Length: 28 Offset: 8128 (0x1fc0) Flags: NORMAL COPY: 0 Item 3 -- Length: 28 Offset: 8096 (0x1fa0) Flags: NORMAL @@ -1124,7 +972,7 @@ ----- Item 1 -- Length: 28 Offset: 8160 (0x1fe0) Flags: NORMAL -COPY: -1 +COPY: 4294967295 Item 2 -- Length: 28 Offset: 8128 (0x1fc0) Flags: NORMAL COPY: 0 Item 3 -- Length: 28 Offset: 8096 (0x1fa0) Flags: NORMAL @@ -1133,48 +981,6 @@ COPY: \N -*** End of File Encountered. Last Block Read: 0 *** --- ----------------------------------------------------------------------------------------------- --- -create table xml (x xml); -insert into xml values (''), (null); -\set relname xml -\ir run_test.sql -\echo Testing :relname -Testing xml -vacuum :"relname"; -checkpoint; -select relfilenode from pg_class where relname = :'relname' \gset -select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset -\set output :relname '.heap' -\lo_export :oid :output -\setenv relname :relname -\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" - -******************************************************************* -* PostgreSQL File/Block Formatted Dump Utility -* -* File: xml.heap -* Options used: -D xml -******************************************************************* - -Block 0 ******************************************************** -
----- - Block Offset: 0x00000000 Offsets: Lower 32 (0x0020) - Block: Size 8192 Version 4 Upper 8128 (0x1fc0) - LSN: logid . recoff 0x........ Special 8192 (0x2000) - Items: 2 Free Space: 8096 - Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) - Length (including item array): 32 - - ----- - Item 1 -- Length: 36 Offset: 8152 (0x1fd8) Flags: NORMAL -COPY: - Item 2 -- Length: 24 Offset: 8128 (0x1fc0) Flags: NORMAL -COPY: \N - - *** End of File Encountered. Last Block Read: 0 *** -- ---------------------------------------------------------------------------------------------- diff -Nru postgresql-filedump-14.1/expected/float_1.out postgresql-filedump-16.0/expected/float_1.out --- postgresql-filedump-14.1/expected/float_1.out 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/expected/float_1.out 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,104 @@ +-- 64 bit output in *.out, 32 bit output in *_3.out +-- PG12+ output in *.out/*_3.out, earlier in *_1.out/*_4.out +select oid as datoid from pg_database where datname = current_database() \gset +---------------------------------------------------------------------------------------------- +create table float4 (x float4); +insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); +\set relname float4 +\ir run_test.sql +\echo Testing :relname +Testing float4 +vacuum :"relname"; +checkpoint; +select relfilenode from pg_class where relname = :'relname' \gset +select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset +\set output :relname '.heap' +\lo_export :oid :output +\setenv relname :relname +\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" + +******************************************************************* +* PostgreSQL File/Block Formatted Dump Utility +* +* File: float4.heap +* Options used: -D float4 +******************************************************************* + +Block 0 ******************************************************** +
----- + Block Offset: 0x00000000 Offsets: Lower 48 (0x0030) + Block: Size 8192 Version 4 Upper 8008 (0x1f48) + LSN: logid . recoff 0x........ Special 8192 (0x2000) + Items: 6 Free Space: 7960 + Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) + Length (including item array): 48 + + ----- + Item 1 -- Length: 28 Offset: 8160 (0x1fe0) Flags: NORMAL +COPY: 0.000000000000 + Item 2 -- Length: 28 Offset: 8128 (0x1fc0) Flags: NORMAL +COPY: -0.000000000000 + Item 3 -- Length: 28 Offset: 8096 (0x1fa0) Flags: NORMAL +COPY: -inf + Item 4 -- Length: 28 Offset: 8064 (0x1f80) Flags: NORMAL +COPY: inf + Item 5 -- Length: 28 Offset: 8032 (0x1f60) Flags: NORMAL +COPY: nan + Item 6 -- Length: 24 Offset: 8008 (0x1f48) Flags: NORMAL +COPY: \N + + +*** End of File Encountered. Last Block Read: 0 *** +-- +---------------------------------------------------------------------------------------------- +-- +create table float8 (x float8); +insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); +\set relname float8 +\ir run_test.sql +\echo Testing :relname +Testing float8 +vacuum :"relname"; +checkpoint; +select relfilenode from pg_class where relname = :'relname' \gset +select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset +\set output :relname '.heap' +\lo_export :oid :output +\setenv relname :relname +\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" + +******************************************************************* +* PostgreSQL File/Block Formatted Dump Utility +* +* File: float8.heap +* Options used: -D float8 +******************************************************************* + +Block 0 ******************************************************** +
----- + Block Offset: 0x00000000 Offsets: Lower 48 (0x0030) + Block: Size 8192 Version 4 Upper 8008 (0x1f48) + LSN: logid . recoff 0x........ Special 8192 (0x2000) + Items: 6 Free Space: 7960 + Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) + Length (including item array): 48 + + ----- + Item 1 -- Length: 32 Offset: 8160 (0x1fe0) Flags: NORMAL +COPY: 0.000000000000 + Item 2 -- Length: 32 Offset: 8128 (0x1fc0) Flags: NORMAL +COPY: -0.000000000000 + Item 3 -- Length: 32 Offset: 8096 (0x1fa0) Flags: NORMAL +COPY: -inf + Item 4 -- Length: 32 Offset: 8064 (0x1f80) Flags: NORMAL +COPY: inf + Item 5 -- Length: 32 Offset: 8032 (0x1f60) Flags: NORMAL +COPY: nan + Item 6 -- Length: 24 Offset: 8008 (0x1f48) Flags: NORMAL +COPY: \N + + +*** End of File Encountered. Last Block Read: 0 *** +-- +---------------------------------------------------------------------------------------------- +-- diff -Nru postgresql-filedump-14.1/expected/float_3.out postgresql-filedump-16.0/expected/float_3.out --- postgresql-filedump-14.1/expected/float_3.out 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/expected/float_3.out 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,104 @@ +-- 64 bit output in *.out, 32 bit output in *_3.out +-- PG12+ output in *.out/*_3.out, earlier in *_1.out/*_4.out +select oid as datoid from pg_database where datname = current_database() \gset +---------------------------------------------------------------------------------------------- +create table float4 (x float4); +insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); +\set relname float4 +\ir run_test.sql +\echo Testing :relname +Testing float4 +vacuum :"relname"; +checkpoint; +select relfilenode from pg_class where relname = :'relname' \gset +select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset +\set output :relname '.heap' +\lo_export :oid :output +\setenv relname :relname +\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" + +******************************************************************* +* PostgreSQL File/Block Formatted Dump Utility +* +* File: float4.heap +* Options used: -D float4 +******************************************************************* + +Block 0 ******************************************************** +
----- + Block Offset: 0x00000000 Offsets: Lower 48 (0x0030) + Block: Size 8192 Version 4 Upper 8028 (0x1f5c) + LSN: logid . recoff 0x........ Special 8192 (0x2000) + Items: 6 Free Space: 7980 + Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) + Length (including item array): 48 + + ----- + Item 1 -- Length: 28 Offset: 8164 (0x1fe4) Flags: NORMAL +COPY: 0.000000000000 + Item 2 -- Length: 28 Offset: 8136 (0x1fc8) Flags: NORMAL +COPY: -0.000000000000 + Item 3 -- Length: 28 Offset: 8108 (0x1fac) Flags: NORMAL +COPY: -Infinity + Item 4 -- Length: 28 Offset: 8080 (0x1f90) Flags: NORMAL +COPY: Infinity + Item 5 -- Length: 28 Offset: 8052 (0x1f74) Flags: NORMAL +COPY: NaN + Item 6 -- Length: 24 Offset: 8028 (0x1f5c) Flags: NORMAL +COPY: \N + + +*** End of File Encountered. Last Block Read: 0 *** +-- +---------------------------------------------------------------------------------------------- +-- +create table float8 (x float8); +insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); +\set relname float8 +\ir run_test.sql +\echo Testing :relname +Testing float8 +vacuum :"relname"; +checkpoint; +select relfilenode from pg_class where relname = :'relname' \gset +select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset +\set output :relname '.heap' +\lo_export :oid :output +\setenv relname :relname +\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" + +******************************************************************* +* PostgreSQL File/Block Formatted Dump Utility +* +* File: float8.heap +* Options used: -D float8 +******************************************************************* + +Block 0 ******************************************************** +
----- + Block Offset: 0x00000000 Offsets: Lower 48 (0x0030) + Block: Size 8192 Version 4 Upper 8008 (0x1f48) + LSN: logid . recoff 0x........ Special 8192 (0x2000) + Items: 6 Free Space: 7960 + Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) + Length (including item array): 48 + + ----- + Item 1 -- Length: 32 Offset: 8160 (0x1fe0) Flags: NORMAL +COPY: 0.000000000000 + Item 2 -- Length: 32 Offset: 8128 (0x1fc0) Flags: NORMAL +COPY: -0.000000000000 + Item 3 -- Length: 32 Offset: 8096 (0x1fa0) Flags: NORMAL +COPY: -Infinity + Item 4 -- Length: 32 Offset: 8064 (0x1f80) Flags: NORMAL +COPY: Infinity + Item 5 -- Length: 32 Offset: 8032 (0x1f60) Flags: NORMAL +COPY: NaN + Item 6 -- Length: 24 Offset: 8008 (0x1f48) Flags: NORMAL +COPY: \N + + +*** End of File Encountered. Last Block Read: 0 *** +-- +---------------------------------------------------------------------------------------------- +-- diff -Nru postgresql-filedump-14.1/expected/float_4.out postgresql-filedump-16.0/expected/float_4.out --- postgresql-filedump-14.1/expected/float_4.out 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/expected/float_4.out 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,104 @@ +-- 64 bit output in *.out, 32 bit output in *_3.out +-- PG12+ output in *.out/*_3.out, earlier in *_1.out/*_4.out +select oid as datoid from pg_database where datname = current_database() \gset +---------------------------------------------------------------------------------------------- +create table float4 (x float4); +insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); +\set relname float4 +\ir run_test.sql +\echo Testing :relname +Testing float4 +vacuum :"relname"; +checkpoint; +select relfilenode from pg_class where relname = :'relname' \gset +select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset +\set output :relname '.heap' +\lo_export :oid :output +\setenv relname :relname +\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" + +******************************************************************* +* PostgreSQL File/Block Formatted Dump Utility +* +* File: float4.heap +* Options used: -D float4 +******************************************************************* + +Block 0 ******************************************************** +
----- + Block Offset: 0x00000000 Offsets: Lower 48 (0x0030) + Block: Size 8192 Version 4 Upper 8028 (0x1f5c) + LSN: logid . recoff 0x........ Special 8192 (0x2000) + Items: 6 Free Space: 7980 + Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) + Length (including item array): 48 + + ----- + Item 1 -- Length: 28 Offset: 8164 (0x1fe4) Flags: NORMAL +COPY: 0.000000000000 + Item 2 -- Length: 28 Offset: 8136 (0x1fc8) Flags: NORMAL +COPY: -0.000000000000 + Item 3 -- Length: 28 Offset: 8108 (0x1fac) Flags: NORMAL +COPY: -inf + Item 4 -- Length: 28 Offset: 8080 (0x1f90) Flags: NORMAL +COPY: inf + Item 5 -- Length: 28 Offset: 8052 (0x1f74) Flags: NORMAL +COPY: nan + Item 6 -- Length: 24 Offset: 8028 (0x1f5c) Flags: NORMAL +COPY: \N + + +*** End of File Encountered. Last Block Read: 0 *** +-- +---------------------------------------------------------------------------------------------- +-- +create table float8 (x float8); +insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); +\set relname float8 +\ir run_test.sql +\echo Testing :relname +Testing float8 +vacuum :"relname"; +checkpoint; +select relfilenode from pg_class where relname = :'relname' \gset +select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset +\set output :relname '.heap' +\lo_export :oid :output +\setenv relname :relname +\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" + +******************************************************************* +* PostgreSQL File/Block Formatted Dump Utility +* +* File: float8.heap +* Options used: -D float8 +******************************************************************* + +Block 0 ******************************************************** +
----- + Block Offset: 0x00000000 Offsets: Lower 48 (0x0030) + Block: Size 8192 Version 4 Upper 8008 (0x1f48) + LSN: logid . recoff 0x........ Special 8192 (0x2000) + Items: 6 Free Space: 7960 + Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) + Length (including item array): 48 + + ----- + Item 1 -- Length: 32 Offset: 8160 (0x1fe0) Flags: NORMAL +COPY: 0.000000000000 + Item 2 -- Length: 32 Offset: 8128 (0x1fc0) Flags: NORMAL +COPY: -0.000000000000 + Item 3 -- Length: 32 Offset: 8096 (0x1fa0) Flags: NORMAL +COPY: -inf + Item 4 -- Length: 32 Offset: 8064 (0x1f80) Flags: NORMAL +COPY: inf + Item 5 -- Length: 32 Offset: 8032 (0x1f60) Flags: NORMAL +COPY: nan + Item 6 -- Length: 24 Offset: 8008 (0x1f48) Flags: NORMAL +COPY: \N + + +*** End of File Encountered. Last Block Read: 0 *** +-- +---------------------------------------------------------------------------------------------- +-- diff -Nru postgresql-filedump-14.1/expected/float.out postgresql-filedump-16.0/expected/float.out --- postgresql-filedump-14.1/expected/float.out 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/expected/float.out 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,104 @@ +-- 64 bit output in *.out, 32 bit output in *_3.out +-- PG12+ output in *.out/*_3.out, earlier in *_1.out/*_4.out +select oid as datoid from pg_database where datname = current_database() \gset +---------------------------------------------------------------------------------------------- +create table float4 (x float4); +insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); +\set relname float4 +\ir run_test.sql +\echo Testing :relname +Testing float4 +vacuum :"relname"; +checkpoint; +select relfilenode from pg_class where relname = :'relname' \gset +select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset +\set output :relname '.heap' +\lo_export :oid :output +\setenv relname :relname +\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" + +******************************************************************* +* PostgreSQL File/Block Formatted Dump Utility +* +* File: float4.heap +* Options used: -D float4 +******************************************************************* + +Block 0 ******************************************************** +
----- + Block Offset: 0x00000000 Offsets: Lower 48 (0x0030) + Block: Size 8192 Version 4 Upper 8008 (0x1f48) + LSN: logid . recoff 0x........ Special 8192 (0x2000) + Items: 6 Free Space: 7960 + Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) + Length (including item array): 48 + + ----- + Item 1 -- Length: 28 Offset: 8160 (0x1fe0) Flags: NORMAL +COPY: 0.000000000000 + Item 2 -- Length: 28 Offset: 8128 (0x1fc0) Flags: NORMAL +COPY: -0.000000000000 + Item 3 -- Length: 28 Offset: 8096 (0x1fa0) Flags: NORMAL +COPY: -Infinity + Item 4 -- Length: 28 Offset: 8064 (0x1f80) Flags: NORMAL +COPY: Infinity + Item 5 -- Length: 28 Offset: 8032 (0x1f60) Flags: NORMAL +COPY: NaN + Item 6 -- Length: 24 Offset: 8008 (0x1f48) Flags: NORMAL +COPY: \N + + +*** End of File Encountered. Last Block Read: 0 *** +-- +---------------------------------------------------------------------------------------------- +-- +create table float8 (x float8); +insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); +\set relname float8 +\ir run_test.sql +\echo Testing :relname +Testing float8 +vacuum :"relname"; +checkpoint; +select relfilenode from pg_class where relname = :'relname' \gset +select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset +\set output :relname '.heap' +\lo_export :oid :output +\setenv relname :relname +\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" + +******************************************************************* +* PostgreSQL File/Block Formatted Dump Utility +* +* File: float8.heap +* Options used: -D float8 +******************************************************************* + +Block 0 ******************************************************** +
----- + Block Offset: 0x00000000 Offsets: Lower 48 (0x0030) + Block: Size 8192 Version 4 Upper 8008 (0x1f48) + LSN: logid . recoff 0x........ Special 8192 (0x2000) + Items: 6 Free Space: 7960 + Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) + Length (including item array): 48 + + ----- + Item 1 -- Length: 32 Offset: 8160 (0x1fe0) Flags: NORMAL +COPY: 0.000000000000 + Item 2 -- Length: 32 Offset: 8128 (0x1fc0) Flags: NORMAL +COPY: -0.000000000000 + Item 3 -- Length: 32 Offset: 8096 (0x1fa0) Flags: NORMAL +COPY: -Infinity + Item 4 -- Length: 32 Offset: 8064 (0x1f80) Flags: NORMAL +COPY: Infinity + Item 5 -- Length: 32 Offset: 8032 (0x1f60) Flags: NORMAL +COPY: NaN + Item 6 -- Length: 24 Offset: 8008 (0x1f48) Flags: NORMAL +COPY: \N + + +*** End of File Encountered. Last Block Read: 0 *** +-- +---------------------------------------------------------------------------------------------- +-- diff -Nru postgresql-filedump-14.1/expected/numeric_1.out postgresql-filedump-16.0/expected/numeric_1.out --- postgresql-filedump-14.1/expected/numeric_1.out 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/expected/numeric_1.out 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,56 @@ +-- 64 bit output in *.out, 32 bit output in *_3.out +-- PG14+ output in *.out/*_3.out, earlier in *_1.out/*_4.out +select oid as datoid from pg_database where datname = current_database() \gset +---------------------------------------------------------------------------------------------- +create table numeric (x numeric); +insert into numeric values (0), ('12341234'), ('-567890'), ('NaN'), (null); +insert into numeric values ('-Infinity'), ('Infinity'); -- needs PG 14 +ERROR: invalid input syntax for type numeric: "-Infinity" +LINE 1: insert into numeric values ('-Infinity'), ('Infinity'); + ^ +\set relname numeric +\ir run_test.sql +\echo Testing :relname +Testing numeric +vacuum :"relname"; +checkpoint; +select relfilenode from pg_class where relname = :'relname' \gset +select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset +\set output :relname '.heap' +\lo_export :oid :output +\setenv relname :relname +\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" + +******************************************************************* +* PostgreSQL File/Block Formatted Dump Utility +* +* File: numeric.heap +* Options used: -D numeric +******************************************************************* + +Block 0 ******************************************************** +
----- + Block Offset: 0x00000000 Offsets: Lower 44 (0x002c) + Block: Size 8192 Version 4 Upper 8040 (0x1f68) + LSN: logid . recoff 0x........ Special 8192 (0x2000) + Items: 5 Free Space: 7996 + Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) + Length (including item array): 44 + + ----- + Item 1 -- Length: 27 Offset: 8160 (0x1fe0) Flags: NORMAL +COPY: 0 + Item 2 -- Length: 31 Offset: 8128 (0x1fc0) Flags: NORMAL +COPY: 12341234 + Item 3 -- Length: 31 Offset: 8096 (0x1fa0) Flags: NORMAL +COPY: -567890 + Item 4 -- Length: 27 Offset: 8064 (0x1f80) Flags: NORMAL +COPY: NaN + Item 5 -- Length: 24 Offset: 8040 (0x1f68) Flags: NORMAL +COPY: \N + + +*** End of File Encountered. Last Block Read: 0 *** +-- +---------------------------------------------------------------------------------------------- +-- diff -Nru postgresql-filedump-14.1/expected/numeric_3.out postgresql-filedump-16.0/expected/numeric_3.out --- postgresql-filedump-14.1/expected/numeric_3.out 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/expected/numeric_3.out 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,57 @@ +-- 64 bit output in *.out, 32 bit output in *_3.out +-- PG14+ output in *.out/*_3.out, earlier in *_1.out/*_4.out +select oid as datoid from pg_database where datname = current_database() \gset +---------------------------------------------------------------------------------------------- +create table numeric (x numeric); +insert into numeric values (0), ('12341234'), ('-567890'), ('NaN'), (null); +insert into numeric values ('-Infinity'), ('Infinity'); -- needs PG 14 +\set relname numeric +\ir run_test.sql +\echo Testing :relname +Testing numeric +vacuum :"relname"; +checkpoint; +select relfilenode from pg_class where relname = :'relname' \gset +select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset +\set output :relname '.heap' +\lo_export :oid :output +\setenv relname :relname +\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" + +******************************************************************* +* PostgreSQL File/Block Formatted Dump Utility +* +* File: numeric.heap +* Options used: -D numeric +******************************************************************* + +Block 0 ******************************************************** +
----- + Block Offset: 0x00000000 Offsets: Lower 52 (0x0034) + Block: Size 8192 Version 4 Upper 7992 (0x1f38) + LSN: logid . recoff 0x........ Special 8192 (0x2000) + Items: 7 Free Space: 7940 + Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) + Length (including item array): 52 + + ----- + Item 1 -- Length: 27 Offset: 8164 (0x1fe4) Flags: NORMAL +COPY: 0 + Item 2 -- Length: 31 Offset: 8132 (0x1fc4) Flags: NORMAL +COPY: 12341234 + Item 3 -- Length: 31 Offset: 8100 (0x1fa4) Flags: NORMAL +COPY: -567890 + Item 4 -- Length: 27 Offset: 8072 (0x1f88) Flags: NORMAL +COPY: NaN + Item 5 -- Length: 24 Offset: 8048 (0x1f70) Flags: NORMAL +COPY: \N + Item 6 -- Length: 27 Offset: 8020 (0x1f54) Flags: NORMAL +COPY: -Infinity + Item 7 -- Length: 27 Offset: 7992 (0x1f38) Flags: NORMAL +COPY: Infinity + + +*** End of File Encountered. Last Block Read: 0 *** +-- +---------------------------------------------------------------------------------------------- +-- diff -Nru postgresql-filedump-14.1/expected/numeric_4.out postgresql-filedump-16.0/expected/numeric_4.out --- postgresql-filedump-14.1/expected/numeric_4.out 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/expected/numeric_4.out 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,56 @@ +-- 64 bit output in *.out, 32 bit output in *_3.out +-- PG14+ output in *.out/*_3.out, earlier in *_1.out/*_4.out +select oid as datoid from pg_database where datname = current_database() \gset +---------------------------------------------------------------------------------------------- +create table numeric (x numeric); +insert into numeric values (0), ('12341234'), ('-567890'), ('NaN'), (null); +insert into numeric values ('-Infinity'), ('Infinity'); -- needs PG 14 +ERROR: invalid input syntax for type numeric: "-Infinity" +LINE 1: insert into numeric values ('-Infinity'), ('Infinity'); + ^ +\set relname numeric +\ir run_test.sql +\echo Testing :relname +Testing numeric +vacuum :"relname"; +checkpoint; +select relfilenode from pg_class where relname = :'relname' \gset +select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset +\set output :relname '.heap' +\lo_export :oid :output +\setenv relname :relname +\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" + +******************************************************************* +* PostgreSQL File/Block Formatted Dump Utility +* +* File: numeric.heap +* Options used: -D numeric +******************************************************************* + +Block 0 ******************************************************** +
----- + Block Offset: 0x00000000 Offsets: Lower 44 (0x002c) + Block: Size 8192 Version 4 Upper 8048 (0x1f70) + LSN: logid . recoff 0x........ Special 8192 (0x2000) + Items: 5 Free Space: 8004 + Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) + Length (including item array): 44 + + ----- + Item 1 -- Length: 27 Offset: 8164 (0x1fe4) Flags: NORMAL +COPY: 0 + Item 2 -- Length: 31 Offset: 8132 (0x1fc4) Flags: NORMAL +COPY: 12341234 + Item 3 -- Length: 31 Offset: 8100 (0x1fa4) Flags: NORMAL +COPY: -567890 + Item 4 -- Length: 27 Offset: 8072 (0x1f88) Flags: NORMAL +COPY: NaN + Item 5 -- Length: 24 Offset: 8048 (0x1f70) Flags: NORMAL +COPY: \N + + +*** End of File Encountered. Last Block Read: 0 *** +-- +---------------------------------------------------------------------------------------------- +-- diff -Nru postgresql-filedump-14.1/expected/numeric.out postgresql-filedump-16.0/expected/numeric.out --- postgresql-filedump-14.1/expected/numeric.out 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/expected/numeric.out 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,57 @@ +-- 64 bit output in *.out, 32 bit output in *_3.out +-- PG14+ output in *.out/*_3.out, earlier in *_1.out/*_4.out +select oid as datoid from pg_database where datname = current_database() \gset +---------------------------------------------------------------------------------------------- +create table numeric (x numeric); +insert into numeric values (0), ('12341234'), ('-567890'), ('NaN'), (null); +insert into numeric values ('-Infinity'), ('Infinity'); -- needs PG 14 +\set relname numeric +\ir run_test.sql +\echo Testing :relname +Testing numeric +vacuum :"relname"; +checkpoint; +select relfilenode from pg_class where relname = :'relname' \gset +select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset +\set output :relname '.heap' +\lo_export :oid :output +\setenv relname :relname +\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" + +******************************************************************* +* PostgreSQL File/Block Formatted Dump Utility +* +* File: numeric.heap +* Options used: -D numeric +******************************************************************* + +Block 0 ******************************************************** +
----- + Block Offset: 0x00000000 Offsets: Lower 52 (0x0034) + Block: Size 8192 Version 4 Upper 7976 (0x1f28) + LSN: logid . recoff 0x........ Special 8192 (0x2000) + Items: 7 Free Space: 7924 + Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) + Length (including item array): 52 + + ----- + Item 1 -- Length: 27 Offset: 8160 (0x1fe0) Flags: NORMAL +COPY: 0 + Item 2 -- Length: 31 Offset: 8128 (0x1fc0) Flags: NORMAL +COPY: 12341234 + Item 3 -- Length: 31 Offset: 8096 (0x1fa0) Flags: NORMAL +COPY: -567890 + Item 4 -- Length: 27 Offset: 8064 (0x1f80) Flags: NORMAL +COPY: NaN + Item 5 -- Length: 24 Offset: 8040 (0x1f68) Flags: NORMAL +COPY: \N + Item 6 -- Length: 27 Offset: 8008 (0x1f48) Flags: NORMAL +COPY: -Infinity + Item 7 -- Length: 27 Offset: 7976 (0x1f28) Flags: NORMAL +COPY: Infinity + + +*** End of File Encountered. Last Block Read: 0 *** +-- +---------------------------------------------------------------------------------------------- +-- diff -Nru postgresql-filedump-14.1/expected/xml_1.out postgresql-filedump-16.0/expected/xml_1.out --- postgresql-filedump-14.1/expected/xml_1.out 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/expected/xml_1.out 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,38 @@ +-- 64 bit output in *.out, 32 bit output in *_3.out +-- server without --with-libxml support output in *_1.out +select oid as datoid from pg_database where datname = current_database() \gset +---------------------------------------------------------------------------------------------- +create table xml (x xml); +insert into xml values (''), (null); +ERROR: unsupported XML feature +LINE 1: insert into xml values (''), (null); + ^ +DETAIL: This functionality requires the server to be built with libxml support. +HINT: You need to rebuild PostgreSQL using --with-libxml. +\set relname xml +\ir run_test.sql +\echo Testing :relname +Testing xml +vacuum :"relname"; +checkpoint; +select relfilenode from pg_class where relname = :'relname' \gset +select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset +\set output :relname '.heap' +\lo_export :oid :output +\setenv relname :relname +\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" + +******************************************************************* +* PostgreSQL File/Block Formatted Dump Utility +* +* File: xml.heap +* Options used: -D xml +******************************************************************* +Error: Unable to read full page header from block 0. + ===> Read 0 bytes +Notice: Block size determined from reading block 0 is zero, using default 8192 instead. +Hint: Use -S to specify the size manually. +Error: Premature end of file encountered. +-- +---------------------------------------------------------------------------------------------- +-- diff -Nru postgresql-filedump-14.1/expected/xml_3.out postgresql-filedump-16.0/expected/xml_3.out --- postgresql-filedump-14.1/expected/xml_3.out 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/expected/xml_3.out 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,46 @@ +-- 64 bit output in *.out, 32 bit output in *_3.out +-- server without --with-libxml support output in *_1.out +select oid as datoid from pg_database where datname = current_database() \gset +---------------------------------------------------------------------------------------------- +create table xml (x xml); +insert into xml values (''), (null); +\set relname xml +\ir run_test.sql +\echo Testing :relname +Testing xml +vacuum :"relname"; +checkpoint; +select relfilenode from pg_class where relname = :'relname' \gset +select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset +\set output :relname '.heap' +\lo_export :oid :output +\setenv relname :relname +\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" + +******************************************************************* +* PostgreSQL File/Block Formatted Dump Utility +* +* File: xml.heap +* Options used: -D xml +******************************************************************* + +Block 0 ******************************************************** +
----- + Block Offset: 0x00000000 Offsets: Lower 32 (0x0020) + Block: Size 8192 Version 4 Upper 8132 (0x1fc4) + LSN: logid . recoff 0x........ Special 8192 (0x2000) + Items: 2 Free Space: 8100 + Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) + Length (including item array): 32 + + ----- + Item 1 -- Length: 36 Offset: 8156 (0x1fdc) Flags: NORMAL +COPY: + Item 2 -- Length: 24 Offset: 8132 (0x1fc4) Flags: NORMAL +COPY: \N + + +*** End of File Encountered. Last Block Read: 0 *** +-- +---------------------------------------------------------------------------------------------- +-- diff -Nru postgresql-filedump-14.1/expected/xml.out postgresql-filedump-16.0/expected/xml.out --- postgresql-filedump-14.1/expected/xml.out 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/expected/xml.out 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,46 @@ +-- 64 bit output in *.out, 32 bit output in *_3.out +-- server without --with-libxml support output in *_1.out +select oid as datoid from pg_database where datname = current_database() \gset +---------------------------------------------------------------------------------------------- +create table xml (x xml); +insert into xml values (''), (null); +\set relname xml +\ir run_test.sql +\echo Testing :relname +Testing xml +vacuum :"relname"; +checkpoint; +select relfilenode from pg_class where relname = :'relname' \gset +select lo_import(format('base/%s/%s', :'datoid', :'relfilenode')) as oid \gset +\set output :relname '.heap' +\lo_export :oid :output +\setenv relname :relname +\! pg_filedump -D $relname $relname.heap | sed -e "s/logid ./logid ./" -e "s/recoff 0x......../recoff 0x......../" + +******************************************************************* +* PostgreSQL File/Block Formatted Dump Utility +* +* File: xml.heap +* Options used: -D xml +******************************************************************* + +Block 0 ******************************************************** +
----- + Block Offset: 0x00000000 Offsets: Lower 32 (0x0020) + Block: Size 8192 Version 4 Upper 8128 (0x1fc0) + LSN: logid . recoff 0x........ Special 8192 (0x2000) + Items: 2 Free Space: 8096 + Checksum: 0x0000 Prune XID: 0x00000000 Flags: 0x0004 (ALL_VISIBLE) + Length (including item array): 32 + + ----- + Item 1 -- Length: 36 Offset: 8152 (0x1fd8) Flags: NORMAL +COPY: + Item 2 -- Length: 24 Offset: 8128 (0x1fc0) Flags: NORMAL +COPY: \N + + +*** End of File Encountered. Last Block Read: 0 *** +-- +---------------------------------------------------------------------------------------------- +-- diff -Nru postgresql-filedump-14.1/.github/workflows/ci.yml postgresql-filedump-16.0/.github/workflows/ci.yml --- postgresql-filedump-14.1/.github/workflows/ci.yml 2022-03-30 13:04:59.000000000 +0000 +++ postgresql-filedump-16.0/.github/workflows/ci.yml 2023-09-14 13:37:45.000000000 +0000 @@ -7,10 +7,15 @@ strategy: matrix: pg: + - 16 - 15 - 14 # versions before 14 no not support Infinity in numeric + - 13 + - 12 # versions before 12 have a different output format for floats (inf/Infinity, nan/NaN) + - 11 + - 10 name: 🐘 PostgreSQL ${{ matrix.pg }} runs-on: ubuntu-latest @@ -20,7 +25,7 @@ - name: Start PostgreSQL ${{ matrix.pg }} run: pg-start ${{ matrix.pg }} - name: Check out the repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install extra build dependencies run: sudo apt-get install -y liblz4-dev - name: Build and test on PostgreSQL ${{ matrix.pg }} diff -Nru postgresql-filedump-14.1/Makefile postgresql-filedump-16.0/Makefile --- postgresql-filedump-14.1/Makefile 2022-03-30 13:04:59.000000000 +0000 +++ postgresql-filedump-16.0/Makefile 2023-09-14 13:37:45.000000000 +0000 @@ -1,11 +1,11 @@ -# View README.pg_filedump first +# View README.pg_filedump.md first # note this must match version macros in pg_filedump.h -FD_VERSION=14.1 +FD_VERSION=16.0 PROGRAM = pg_filedump OBJS = pg_filedump.o decode.o stringinfo.o -REGRESS = datatypes +REGRESS = datatypes float numeric xml EXTRA_CLEAN = *.heap PG_CONFIG = pg_config @@ -19,7 +19,7 @@ LIBS = $(libpq_pgport) endif -DISTFILES= README.pg_filedump Makefile Makefile.contrib \ +DISTFILES= README.pg_filedump.md Makefile \ pg_filedump.h pg_filedump.c decode.h decode.c stringinfo.c dist: diff -Nru postgresql-filedump-14.1/Makefile.contrib postgresql-filedump-16.0/Makefile.contrib --- postgresql-filedump-14.1/Makefile.contrib 2022-03-30 13:04:59.000000000 +0000 +++ postgresql-filedump-16.0/Makefile.contrib 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -PROGRAM = pg_filedump -OBJS = decode.o pg_filedump.o stringinfo.o - -DOCS = README.pg_filedump - -ifdef USE_PGXS - PG_CONFIG = pg_config - PGXS := $(shell $(PG_CONFIG) --pgxs) - include $(PGXS) -else - subdir = contrib/pg_filedump - top_builddir = ../.. - include $(top_builddir)/src/Makefile.global - include $(top_srcdir)/contrib/contrib-global.mk -endif - -# avoid linking against all libs that the server links against (xml, selinux, ...) -ifneq ($(findstring -llz4,$(LIBS)),) - LIBS = $(libpq_pgport) -llz4 -else - LIBS = $(libpq_pgport) -endif diff -Nru postgresql-filedump-14.1/pg_filedump.c postgresql-filedump-16.0/pg_filedump.c --- postgresql-filedump-14.1/pg_filedump.c 2022-03-30 13:04:59.000000000 +0000 +++ postgresql-filedump-16.0/pg_filedump.c 2023-09-14 13:37:45.000000000 +0000 @@ -3,7 +3,7 @@ * formatting heap (data), index and control files. * * Copyright (c) 2002-2010 Red Hat, Inc. - * Copyright (c) 2011-2022, PostgreSQL Global Development Group + * Copyright (c) 2011-2023, PostgreSQL Global Development Group * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -159,7 +159,7 @@ printf ("\nVersion %s (for %s)" "\nCopyright (c) 2002-2010 Red Hat, Inc." - "\nCopyright (c) 2011-2022, PostgreSQL Global Development Group\n", + "\nCopyright (c) 2011-2023, PostgreSQL Global Development Group\n", FD_VERSION, FD_PG_VERSION); printf @@ -681,7 +681,7 @@ rewind(fp); if (bytesRead == sizeof(PageHeaderData)) - localSize = (unsigned int) PageGetPageSize(&localCache); + localSize = (unsigned int) PageGetPageSize(localCache); else { printf("Error: Unable to read full page header from block 0.\n" @@ -1502,6 +1502,10 @@ strcat(flagString, "HASGARBAGE|"); if (btreeSection->btpo_flags & BTP_INCOMPLETE_SPLIT) strcat(flagString, "INCOMPLETESPLIT|"); +#if PG_VERSION_NUM >= 140000 + if (btreeSection->btpo_flags & BTP_HAS_FULLXID) + strcat(flagString, "HASFULLXID|"); +#endif if (strlen(flagString)) flagString[strlen(flagString) - 1] = '\0'; @@ -1526,7 +1530,7 @@ { HashPageOpaque hashSection = (HashPageOpaque) (buffer + specialOffset); - if (hashSection->hasho_flag & LH_UNUSED_PAGE) + if ((hashSection->hasho_flag & LH_PAGE_TYPE) == LH_UNUSED_PAGE) strcat(flagString, "UNUSED|"); if (hashSection->hasho_flag & LH_OVERFLOW_PAGE) strcat(flagString, "OVERFLOW|"); @@ -1536,6 +1540,14 @@ strcat(flagString, "BITMAP|"); if (hashSection->hasho_flag & LH_META_PAGE) strcat(flagString, "META|"); + if (hashSection->hasho_flag & LH_BUCKET_BEING_POPULATED) + strcat(flagString, "BUCKET_BEING_POPULATED|"); + if (hashSection->hasho_flag & LH_BUCKET_BEING_SPLIT) + strcat(flagString, "BUCKET_BEING_SPLIT|"); + if (hashSection->hasho_flag & LH_BUCKET_NEEDS_SPLIT_CLEANUP) + strcat(flagString, "BUCKET_NEEDS_SPLIT_CLEANUP|"); + if (hashSection->hasho_flag & LH_PAGE_HAS_DEAD_TUPLES) + strcat(flagString, "PAGE_HAS_DEAD_TUPLES|"); if (strlen(flagString)) flagString[strlen(flagString) - 1] = '\0'; printf(" Hash Index Section:\n" @@ -1561,6 +1573,8 @@ strcat(flagString, "TUPLES_DELETED|"); if (gistSection->flags & F_FOLLOW_RIGHT) strcat(flagString, "FOLLOW_RIGHT|"); + if (gistSection->flags & F_HAS_GARBAGE) + strcat(flagString, "HAS_GARBAGE|"); if (strlen(flagString)) flagString[strlen(flagString) - 1] = '\0'; printf(" GIST Index Section:\n" diff -Nru postgresql-filedump-14.1/pg_filedump.h postgresql-filedump-16.0/pg_filedump.h --- postgresql-filedump-14.1/pg_filedump.h 2022-03-30 13:04:59.000000000 +0000 +++ postgresql-filedump-16.0/pg_filedump.h 2023-09-14 13:37:45.000000000 +0000 @@ -3,7 +3,7 @@ * formatting heap (data), index and control files. * * Copyright (c) 2002-2010 Red Hat, Inc. - * Copyright (c) 2011-2022, PostgreSQL Global Development Group + * Copyright (c) 2011-2023, PostgreSQL Global Development Group * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,8 +22,8 @@ * Original Author: Patrick Macdonald */ -#define FD_VERSION "14.1" /* version ID of pg_filedump */ -#define FD_PG_VERSION "PostgreSQL 8.x .. 14.x" /* PG version it works with */ +#define FD_VERSION "16.0" /* version ID of pg_filedump */ +#define FD_PG_VERSION "PostgreSQL 8.x .. 16.x" /* PG version it works with */ #include "postgres.h" diff -Nru postgresql-filedump-14.1/README.md postgresql-filedump-16.0/README.md --- postgresql-filedump-14.1/README.md 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/README.md 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,98 @@ +# pg_filedump - Display formatted contents of a PostgreSQL heap, index, or control file + +Copyright (c) 2002-2010 Red Hat, Inc. + +Copyright (c) 2011-2023, PostgreSQL Global Development Group + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +Original Author: Patrick Macdonald + + +## Overview: + +pg_filedump is a utility to format PostgreSQL heap/index/control files +into a human-readable form. You can format/dump the files several ways, +as listed in the Invocation section, as well as dumping straight binary. + +The type of file (heap/index) can usually be determined automatically +by the content of the blocks within the file. However, to format a +pg_control file you must use the -c option. + +The default is to format the entire file using the block size listed in +block 0 and display block relative addresses. These defaults can be +modified using run-time options. + +Some options may seem strange but they're there for a reason. For +example, block size. It's there because if the header of block 0 is +corrupt, you need a method of forcing a block size. + + +## Compile/Installation: + +To compile pg_filedump, you will need to have a properly configured +PostgreSQL source tree or the devel packages (with include files) +of the appropriate PostgreSQL major version. + +``` +make PG_CONFIG=/path/to/postgresql/bin/pg_config +make install PG_CONFIG=/path/to/postgresql/bin/pg_config +``` + + +## Invocation: + +``` +Usage: pg_filedump [-abcdfhikxy] [-R startblock [endblock]] [-D attrlist] [-S blocksize] [-s segsize] [-n segnumber] file + +Display formatted contents of a PostgreSQL heap/index/control file +Defaults are: relative addressing, range of the entire file, block + size as listed on block 0 in the file + +The following options are valid for heap and index files: + -a Display absolute addresses when formatting (Block header + information is always block relative) + -b Display binary block images within a range (Option will turn + off all formatting options) + -d Display formatted block content dump (Option will turn off + all other formatting options) + -D Decode tuples using given comma separated list of types + Supported types: + bigint bigserial bool char charN date float float4 float8 int + json macaddr name numeric oid real serial smallint smallserial text + time timestamp timestamptz timetz uuid varchar varcharN xid xml + ~ ignores all attributes left in a tuple + -f Display formatted block content dump along with interpretation + -h Display this information + -i Display interpreted item details + -k Verify block checksums + -o Do not dump old values. + -R Display specific block ranges within the file (Blocks are + indexed from 0) + [startblock]: block to start at + [endblock]: block to end at + A startblock without an endblock will format the single block + -s Force segment size to [segsize] + -t Dump TOAST files + -v Ouput additional information about TOAST relations + -n Force segment number to [segnumber] + -S Force block size to [blocksize] + -x Force interpreted formatting of block items as index items + -y Force interpreted formatting of block items as heap items + +The following options are valid for control files: + -c Interpret the file listed as a control file + -f Display formatted content dump along with interpretation + -S Force block size to [blocksize] +Additional functions: + -m Interpret file as pg_filenode.map file and print contents (all + other options will be ignored) + +Report bugs to +``` + +In most cases it's recommended to use the -i and -f options to get +the most useful dump output. diff -Nru postgresql-filedump-14.1/README.pg_filedump postgresql-filedump-16.0/README.pg_filedump --- postgresql-filedump-14.1/README.pg_filedump 2022-03-30 13:04:59.000000000 +0000 +++ postgresql-filedump-16.0/README.pg_filedump 1970-01-01 00:00:00.000000000 +0000 @@ -1,129 +0,0 @@ -pg_filedump - Display formatted contents of a PostgreSQL heap, index, - or control file. - -Copyright (c) 2002-2010 Red Hat, Inc. -Copyright (c) 2011-2022, PostgreSQL Global Development Group - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -Original Author: Patrick Macdonald - - ------------------------------------------------------------------------- -Overview: - -pg_filedump is a utility to format PostgreSQL heap/index/control files -into a human-readable form. You can format/dump the files several ways, -as listed in the Invocation section, as well as dumping straight binary. - -The type of file (heap/index) can usually be determined automatically -by the content of the blocks within the file. However, to format a -pg_control file you must use the -c option. - -The default is to format the entire file using the block size listed in -block 0 and display block relative addresses. These defaults can be -modified using run-time options. - -Some options may seem strange but they're there for a reason. For -example, block size. It's there because if the header of block 0 is -corrupt, you need a method of forcing a block size. - - ------------------------------------------------------------------------- -Compile/Installation: - -To compile pg_filedump, you will need to have a properly configured -PostgreSQL source tree or complete install tree (with include files) -of the appropriate PostgreSQL major version. - -There are two makefiles included in this package. Makefile is a standalone -makefile for pg_filedump. Makefile.contrib can be used if this package -was untarred in the contrib directory of a PostgreSQL build tree. - - make - make install - -It is also possible to use Makefile.contrib without being in the contrib -directory: - - make -f Makefile.contrib USE_PGXS=1 - -Both methods require that the pg_config program be in your PATH, but should -not require any manual adjustments of the Makefile. - - ------------------------------------------------------------------------- -Invocation: - -pg_filedump [-abcdfhikxy] [-R startblock [endblock]] [-D attrlist] [-S blocksize] [-s segsize] [-n segnumber] file - -Defaults are: relative addressing, range of the entire file, block size - as listed on block 0 in the file - -The following options are valid for heap and index files: - -a Display absolute addresses when formatting (Block header - information is always block relative) - -b Display binary block images within a range (Option will turn - off all formatting options) - -d Display formatted block content dump (Option will turn off - all other formatting options) - -D Decode tuples using given comma separated list of types. - List of supported types: - * bigint - * bigserial - * bool - * char - * charN -- char(n) - * date - * float - * float4 - * float8 - * int - * json - * macaddr - * name - * numeric - * oid - * real - * serial - * smallint - * smallserial - * text - * time - * timestamp - * timetz - * uuid - * varchar - * varcharN -- varchar(n) - * xid - * xml - * ~ -- ignores all attributes left in a tuple - -f Display formatted block content dump along with interpretation - -h Display this information - -i Display interpreted item details - -k Verify block checksums - -R Display specific block ranges within the file (Blocks are - indexed from 0) - [startblock]: block to start at - [endblock]: block to end at - A startblock without an endblock will format the single block - -s Force segment size to [segsize] - -n Force segment number to [segnumber] - -S Force block size to [blocksize] - -x Force interpreted formatting of block items as index items - -y Force interpreted formatting of block items as heap items - -The following options are valid for control files: - -c Interpret the file listed as a control file - -f Display formatted content dump along with interpretation - -S Force block size to [blocksize] - -Additional functions: - -m Interpret file as pg_filenode.map file and print contents - (all other options will be ignored) - -In most cases it's recommended to use the -i and -f options to get -the most useful dump output. diff -Nru postgresql-filedump-14.1/README.pg_filedump.md postgresql-filedump-16.0/README.pg_filedump.md --- postgresql-filedump-14.1/README.pg_filedump.md 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/README.pg_filedump.md 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,98 @@ +# pg_filedump - Display formatted contents of a PostgreSQL heap, index, or control file + +Copyright (c) 2002-2010 Red Hat, Inc. + +Copyright (c) 2011-2023, PostgreSQL Global Development Group + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +Original Author: Patrick Macdonald + + +## Overview: + +pg_filedump is a utility to format PostgreSQL heap/index/control files +into a human-readable form. You can format/dump the files several ways, +as listed in the Invocation section, as well as dumping straight binary. + +The type of file (heap/index) can usually be determined automatically +by the content of the blocks within the file. However, to format a +pg_control file you must use the -c option. + +The default is to format the entire file using the block size listed in +block 0 and display block relative addresses. These defaults can be +modified using run-time options. + +Some options may seem strange but they're there for a reason. For +example, block size. It's there because if the header of block 0 is +corrupt, you need a method of forcing a block size. + + +## Compile/Installation: + +To compile pg_filedump, you will need to have a properly configured +PostgreSQL source tree or the devel packages (with include files) +of the appropriate PostgreSQL major version. + +``` +make PG_CONFIG=/path/to/postgresql/bin/pg_config +make install PG_CONFIG=/path/to/postgresql/bin/pg_config +``` + + +## Invocation: + +``` +Usage: pg_filedump [-abcdfhikxy] [-R startblock [endblock]] [-D attrlist] [-S blocksize] [-s segsize] [-n segnumber] file + +Display formatted contents of a PostgreSQL heap/index/control file +Defaults are: relative addressing, range of the entire file, block + size as listed on block 0 in the file + +The following options are valid for heap and index files: + -a Display absolute addresses when formatting (Block header + information is always block relative) + -b Display binary block images within a range (Option will turn + off all formatting options) + -d Display formatted block content dump (Option will turn off + all other formatting options) + -D Decode tuples using given comma separated list of types + Supported types: + bigint bigserial bool char charN date float float4 float8 int + json macaddr name numeric oid real serial smallint smallserial text + time timestamp timestamptz timetz uuid varchar varcharN xid xml + ~ ignores all attributes left in a tuple + -f Display formatted block content dump along with interpretation + -h Display this information + -i Display interpreted item details + -k Verify block checksums + -o Do not dump old values. + -R Display specific block ranges within the file (Blocks are + indexed from 0) + [startblock]: block to start at + [endblock]: block to end at + A startblock without an endblock will format the single block + -s Force segment size to [segsize] + -t Dump TOAST files + -v Ouput additional information about TOAST relations + -n Force segment number to [segnumber] + -S Force block size to [blocksize] + -x Force interpreted formatting of block items as index items + -y Force interpreted formatting of block items as heap items + +The following options are valid for control files: + -c Interpret the file listed as a control file + -f Display formatted content dump along with interpretation + -S Force block size to [blocksize] +Additional functions: + -m Interpret file as pg_filenode.map file and print contents (all + other options will be ignored) + +Report bugs to +``` + +In most cases it's recommended to use the -i and -f options to get +the most useful dump output. diff -Nru postgresql-filedump-14.1/sql/datatypes.sql postgresql-filedump-16.0/sql/datatypes.sql --- postgresql-filedump-14.1/sql/datatypes.sql 2022-03-30 13:04:59.000000000 +0000 +++ postgresql-filedump-16.0/sql/datatypes.sql 2023-09-14 13:37:45.000000000 +0000 @@ -39,16 +39,6 @@ \set relname date \ir run_test.sql -create table float4 (x float4); -insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); -\set relname float4 -\ir run_test.sql - -create table float8 (x float8); -insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); -\set relname float8 -\ir run_test.sql - create table int (x int); insert into int values (-1), (0), (1), (null); \set relname int @@ -69,11 +59,6 @@ \set relname name \ir run_test.sql -create table numeric (x numeric); -insert into numeric values (0), ('12341234'), ('-567890'), ('-Infinity'), ('Infinity'), ('NaN'), (null); -\set relname numeric -\ir run_test.sql - create table oid (x oid); insert into oid values (-1), (0), (1), (null); \set relname oid @@ -128,8 +113,3 @@ insert into xid values ('-1'), ('0'), ('1'), (null); \set relname xid \ir run_test.sql - -create table xml (x xml); -insert into xml values (''), (null); -\set relname xml -\ir run_test.sql diff -Nru postgresql-filedump-14.1/sql/float.sql postgresql-filedump-16.0/sql/float.sql --- postgresql-filedump-14.1/sql/float.sql 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/sql/float.sql 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,16 @@ +-- 64 bit output in *.out, 32 bit output in *_3.out +-- PG12+ output in *.out/*_3.out, earlier in *_1.out/*_4.out + +select oid as datoid from pg_database where datname = current_database() \gset + +---------------------------------------------------------------------------------------------- + +create table float4 (x float4); +insert into float4 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); +\set relname float4 +\ir run_test.sql + +create table float8 (x float8); +insert into float8 values (0), ('-0'), ('-infinity'), ('infinity'), ('NaN'), (null); +\set relname float8 +\ir run_test.sql diff -Nru postgresql-filedump-14.1/sql/numeric.sql postgresql-filedump-16.0/sql/numeric.sql --- postgresql-filedump-14.1/sql/numeric.sql 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/sql/numeric.sql 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,12 @@ +-- 64 bit output in *.out, 32 bit output in *_3.out +-- PG14+ output in *.out/*_3.out, earlier in *_1.out/*_4.out + +select oid as datoid from pg_database where datname = current_database() \gset + +---------------------------------------------------------------------------------------------- + +create table numeric (x numeric); +insert into numeric values (0), ('12341234'), ('-567890'), ('NaN'), (null); +insert into numeric values ('-Infinity'), ('Infinity'); -- needs PG 14 +\set relname numeric +\ir run_test.sql diff -Nru postgresql-filedump-14.1/sql/xml.sql postgresql-filedump-16.0/sql/xml.sql --- postgresql-filedump-14.1/sql/xml.sql 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-filedump-16.0/sql/xml.sql 2023-09-14 13:37:45.000000000 +0000 @@ -0,0 +1,11 @@ +-- 64 bit output in *.out, 32 bit output in *_3.out +-- server without --with-libxml support output in *_1.out + +select oid as datoid from pg_database where datname = current_database() \gset + +---------------------------------------------------------------------------------------------- + +create table xml (x xml); +insert into xml values (''), (null); +\set relname xml +\ir run_test.sql diff -Nru postgresql-filedump-14.1/stringinfo.c postgresql-filedump-16.0/stringinfo.c --- postgresql-filedump-14.1/stringinfo.c 2022-03-30 13:04:59.000000000 +0000 +++ postgresql-filedump-16.0/stringinfo.c 2023-09-14 13:37:45.000000000 +0000 @@ -75,7 +75,11 @@ * if necessary. */ void +#if PG_VERSION_NUM < 160000 appendBinaryStringInfo(StringInfo str, const char *data, int datalen) +#else +appendBinaryStringInfo(StringInfo str, const void *data, int datalen) +#endif { assert(str != NULL);