Christoph Berg [Tue, 15 Apr 2025 17:33:58 +0000 (17:33 +0000)]
pg_filedump 17.2
* Mask output more wide in tests (@df7cb)
* Fix length computation in numeric type (@ GetsuDer)
* Support PG18 (@df7cb)
* Show GIN block details (@manaldush)
* Read toast chunks in ascending order (@df7cb)
Christoph Berg [Tue, 15 Apr 2025 17:11:33 +0000 (17:11 +0000)]
Read toast chunks in ascending order, looping if required
Toast chunks might be stored out-of-order in the table. We previously
ignored that and hoped for the best, but our toast.sql test actually
exhibits the problem on pre-14 servers where the 5th chunk of the last
test is small enough to fit into the first disk block.
Fix by looping over the table until all chunks have been read. A smarter
solution would require either toast index lookups or caching the chunks.
Close #20.
Author: Christoph Berg <
[email protected]>
Debugging-By: Svetlana Derevyanko <[email protected]>
Christoph Berg [Tue, 15 Apr 2025 15:22:37 +0000 (15:22 +0000)]
Print toast message only for matching toast chunks
When dumping toasted values in verbose mode, show "Read TOAST chunk"
message only for toast chunks that matched the Oid we are looking for.
Maksim Melnikov [Wed, 5 Feb 2025 12:51:25 +0000 (15:51 +0300)]
Show GIN block details
Close #35.
Christoph Berg [Tue, 15 Apr 2025 13:32:07 +0000 (13:32 +0000)]
Fix a typo in comment
Christoph Berg [Tue, 15 Apr 2025 13:18:00 +0000 (15:18 +0200)]
Declare fp static
It's only used in pg_filedump.c.
Christoph Berg [Tue, 15 Apr 2025 13:15:32 +0000 (13:15 +0000)]
Use PRIu64 to format integers
PG18 gets rid of INT64_MODIFIER, move to standard C version.
Svetlana Derevyanko [Thu, 7 Nov 2024 18:47:23 +0000 (21:47 +0300)]
Fixed bug with number of digits for numeric being calculated wrong, which led to outputting junk data.
Close #32.
Christoph Berg [Tue, 15 Apr 2025 12:56:48 +0000 (12:56 +0000)]
Mask all digits of value and toast relation ids
This was not noticed before because I was always running the tests in a
fresh instance.
Close #33.
Author: Svetlana Derevyanko <
[email protected]>
Christoph Berg [Tue, 15 Apr 2025 12:43:10 +0000 (12:43 +0000)]
Mask full LSN and checksum in tests
The old LSN masking didn't consider LSNs with a log id with two or more
digits. Checksums were hard-coded to 0000 so far, but the server might
actually write them.
To not clutter the test files with ever-longer sed commands, move the
command to a new sed.sh file.
Test files updated to follow this change, but there are pre-existing
problems on older PG majors and 32-bit that are still open.
Close #37.
Reported-By: Maksim Melnikov <[email protected]>
Christoph Berg [Thu, 7 Nov 2024 15:26:21 +0000 (15:26 +0000)]
Bump version to 17.1
While at it, bump copyright year as well.
Christoph Berg [Thu, 7 Nov 2024 15:22:15 +0000 (15:22 +0000)]
Makefile: Drop outdated "dist" target
Christoph Berg [Fri, 4 Oct 2024 15:31:20 +0000 (17:31 +0200)]
Disable fast failing of GitHub actions
Christoph Berg [Fri, 4 Oct 2024 15:27:20 +0000 (17:27 +0200)]
Set timezone to UTC
Make us independent from changes to pg_regress' hard-coded Pacific time
zone.
Christoph Berg [Fri, 4 Oct 2024 15:27:03 +0000 (17:27 +0200)]
Add 17 and 18 to versions to test
Christoph Berg [Fri, 19 Jul 2024 12:50:06 +0000 (14:50 +0200)]
Add/fix expected toast output files for PG13- and 32-bit
Christoph Berg [Thu, 18 Jul 2024 13:42:48 +0000 (15:42 +0200)]
pg_filedump 17.0
Christoph Berg [Fri, 7 Jun 2024 11:52:41 +0000 (13:52 +0200)]
Explicitly link against libpgcommon and libpgport
libpq_pgport used to pull these in, but does no longer in PG17.
Christoph Berg [Fri, 7 Jun 2024 11:32:55 +0000 (13:32 +0200)]
Move "number of chunks" to TOAST message
No reason to waste two separate lines on this.
Christoph Berg [Fri, 7 Jun 2024 11:32:12 +0000 (13:32 +0200)]
Remove stray newline printed after toast message
This would print an ever increasing number of newlines between toast
messages.
Christoph Berg [Thu, 6 Jun 2024 16:19:08 +0000 (18:19 +0200)]
Add regression test for toast
Christoph Berg [Thu, 6 Jun 2024 16:11:01 +0000 (18:11 +0200)]
Print type of toast when not decoding it
Christoph Berg [Thu, 6 Jun 2024 14:21:02 +0000 (16:21 +0200)]
Allow finding the toast table in current directory
get_parent_directory() returns "" when there is no directory part;
replace that by ".".
Christoph Berg [Thu, 6 Jun 2024 13:26:31 +0000 (15:26 +0200)]
Add .editorconfig
File copied verbatim from PostgreSQL.
Christoph Berg [Thu, 6 Jun 2024 13:25:38 +0000 (15:25 +0200)]
Replace static buffers with malloc
Since we learned to decode TOASTed values these buffers were too small.
Christoph Berg [Tue, 4 Jun 2024 14:09:22 +0000 (16:09 +0200)]
Drop test specific to btree-deduplication on PG12
Vanilla PG got that feature in PG13 and it's on by default, so the
normal test covers it as well.
Christoph Berg [Tue, 4 Jun 2024 13:35:36 +0000 (15:35 +0200)]
Run build and test as postgres user
GH actions run as root by default which initdb doesn't like.
Christoph Berg [Tue, 4 Jun 2024 13:12:41 +0000 (15:12 +0200)]
Find pg_filedump at test time in PATH
Close #21.
Karina Litskevich [Thu, 16 Nov 2023 08:39:02 +0000 (11:39 +0300)]
Improve Makefile: set PG_CONFIG only if it is not already set
Svetlana Derevyanko [Mon, 22 Jan 2024 09:27:16 +0000 (12:27 +0300)]
Fixes for running tap tests: library for perl tests and option for running as non-priviliged user.
Alexey Namakonov [Fri, 29 Dec 2023 10:21:34 +0000 (13:21 +0300)]
Added TAP tests and parsing specific contents of GIN data pages.
Close #28.
Svetlana Derevyanko [Wed, 29 May 2024 07:57:25 +0000 (10:57 +0300)]
Fixed unaligned use of struct NumericData, which could cause problems on some systems.
Close #29.
Christoph Berg [Thu, 14 Sep 2023 13:37:45 +0000 (15:37 +0200)]
Add a README.md symlink
GitHub doesn't show README.pg_filedump.md by itself.
Christoph Berg [Thu, 14 Sep 2023 13:34:36 +0000 (15:34 +0200)]
Bump version to 16.0
While at it, bump copyright years as well.
Christoph Berg [Thu, 14 Sep 2023 13:31:32 +0000 (15:31 +0200)]
Drop Makefile.contrib before it gets outdated even more
Christoph Berg [Thu, 14 Sep 2023 13:28:01 +0000 (15:28 +0200)]
Convert README file to Markdown format
Christoph Berg [Thu, 14 Sep 2023 12:10:38 +0000 (14:10 +0200)]
Decode oid/xid >= 2^31 correctly
Spotted by alexandervpotapov.
Close #18.
Christoph Berg [Thu, 14 Sep 2023 12:00:40 +0000 (14:00 +0200)]
Fix expected float output file on 64-bit PG12+
Christoph Berg [Thu, 14 Sep 2023 11:56:33 +0000 (13:56 +0200)]
Support testing against servers compiled without --with-libxml support
See #9.
Christoph Berg [Thu, 14 Sep 2023 11:46:30 +0000 (13:46 +0200)]
Support testing float with PG 11 and earlier
See #9.
Christoph Berg [Thu, 14 Sep 2023 11:35:56 +0000 (13:35 +0200)]
Support testing numeric with PG 13 and 14
Close #9.
Christoph Berg [Thu, 14 Sep 2023 10:13:23 +0000 (12:13 +0200)]
Add PG 16 to GitHub action
Karina Litskevich [Fri, 1 Sep 2023 08:01:46 +0000 (11:01 +0300)]
Add support for PostgreSQL v16
Karina Litskevich [Mon, 28 Aug 2023 12:20:09 +0000 (15:20 +0300)]
Add missing flags
Karina Litskevich [Mon, 28 Aug 2023 12:17:51 +0000 (15:17 +0300)]
Fix comparison of hasho_flag field and LH_UNUSED_PAGE
Karina Litskevich [Mon, 28 Aug 2023 11:53:12 +0000 (14:53 +0300)]
Bugfix: make sure fclose is called with a legal argument
fclose(NULL) is an UB
Karina Litskevich [Mon, 28 Aug 2023 11:53:12 +0000 (14:53 +0300)]
Bugfix: free dynamically allocated memory
Christoph Berg [Wed, 30 Mar 2022 13:04:59 +0000 (15:04 +0200)]
Bump copyright year
Christoph Berg [Wed, 30 Mar 2022 12:38:38 +0000 (14:38 +0200)]
Add a non-trivial timetz offset test case
Christoph Berg [Wed, 30 Mar 2022 12:33:43 +0000 (14:33 +0200)]
Decode timestamptz
We unconditionally use +00 on output.
Christoph Berg [Wed, 30 Mar 2022 12:22:43 +0000 (14:22 +0200)]
Decode date and timestamp infinity values
Christoph Berg [Wed, 16 Mar 2022 16:54:53 +0000 (17:54 +0100)]
Fix alignment handling of int64-based types, and of name
Values were generally aligned to sizeof(type), but that is wrong, the
correct handling is __alignof(type). The problem manifests in practice
for int64, where sizeof(int64) is 8, but __alignof(int64) is 4 on 32-bit
platforms.
Independently, "name" was aligned to int32, but it's actually
char-aligned.
Christoph Berg [Wed, 16 Mar 2022 15:30:41 +0000 (16:30 +0100)]
Fix "char" testsuite
Christoph Berg [Wed, 16 Mar 2022 14:48:33 +0000 (15:48 +0100)]
Bump version to 14.1
Christoph Berg [Wed, 16 Mar 2022 13:34:36 +0000 (14:34 +0100)]
Add GitHub workflow
Only test PostgreSQL 14 and 15 since older versions do not support all
datatype values.
Christoph Berg [Tue, 15 Mar 2022 16:28:18 +0000 (17:28 +0100)]
Update testsuite to exercise all datatypes with -D
Svetlana Derevyanko [Fri, 20 Aug 2021 10:04:10 +0000 (13:04 +0300)]
Adding numeric type support
Added numeric type support.
Move data decompression, detoasting and aligning into separated function
to avoid redundancy.
Christoph Berg [Wed, 29 Sep 2021 16:08:17 +0000 (18:08 +0200)]
Remove .travis.yml.
Svetlana Derevyanko [Mon, 19 Jul 2021 11:27:15 +0000 (14:27 +0300)]
Bump version to 14.0
Svetlana Derevyanko [Mon, 23 Aug 2021 08:11:37 +0000 (11:11 +0300)]
Renamed decompressed_size into compressed_size according to actual meaning.
Svetlana Derevyanko [Mon, 23 Aug 2021 07:46:21 +0000 (10:46 +0300)]
Add support for PostgreSQL v14
Add conditional compilation for changed structure members and macro.
Add lz4 compression support.
Richard Yen [Wed, 28 Apr 2021 22:37:29 +0000 (15:37 -0700)]
Add support for decoding pg_filenode.map
Christoph Berg [Mon, 2 Nov 2020 15:47:55 +0000 (16:47 +0100)]
Bump version to 13.1
pg_filedump is compatible with everything from PG 8.x up, say so in the
version string.
Christoph Berg [Mon, 2 Nov 2020 15:44:54 +0000 (16:44 +0100)]
decode.c: Fix int64 format strings for 32 bit architectures
Christoph Berg [Mon, 2 Nov 2020 12:07:38 +0000 (13:07 +0100)]
Refactor testsuite to generate test file at runtime
64 bit output files are *.out, 32 bit in *_3.out
Christoph Berg [Tue, 27 Oct 2020 14:25:46 +0000 (15:25 +0100)]
Support PG14: nextFullXid got renamed to nextXidEpoch
PostgreSQL
fea10a643.
Christoph Berg [Tue, 27 Oct 2020 14:11:16 +0000 (15:11 +0100)]
Fix compilation on PG13
Christoph Berg [Tue, 27 Oct 2020 14:02:56 +0000 (15:02 +0100)]
travis: Add PG13 and 14, and run on focal
Christoph Berg [Thu, 28 Nov 2019 12:44:02 +0000 (13:44 +0100)]
Add testsuite
Add a testsuite exercising pg_filedump on a table shipped in the test
directory. For simplicity, we use the pgxs regress system, even if no
actual SQL commands are executed.
Christoph Berg [Thu, 28 Nov 2019 12:39:29 +0000 (13:39 +0100)]
Ignore more build artifacts
Christoph Berg [Thu, 28 Nov 2019 12:51:25 +0000 (13:51 +0100)]
Strip trailing spaces from output
Christoph Berg [Thu, 28 Nov 2019 12:24:02 +0000 (13:24 +0100)]
Remove non-deterministic bits from output
Get rid of the parts in the output that change over time, so we can
compare the output better in the testsuite.
Christoph Berg [Thu, 28 Nov 2019 11:37:08 +0000 (12:37 +0100)]
Bump copyright years to 2019
Christoph Berg [Thu, 28 Nov 2019 11:35:39 +0000 (12:35 +0100)]
Bump version to 12.0
Guillaume Lelarge [Thu, 28 Nov 2019 11:31:55 +0000 (12:31 +0100)]
Add support for PostgreSQL v12
Christoph Berg [Thu, 28 Nov 2019 10:46:44 +0000 (11:46 +0100)]
Drop our pg_lzcompress copy
The local pg_lzcompress copy was never used in the Makefiles, and is
only necessary on 9.4 or earlier which is EOL very soon anyway.
Christoph Berg [Wed, 27 Nov 2019 14:38:10 +0000 (15:38 +0100)]
Add .travis.yml
Christoph Berg [Thu, 26 Sep 2019 11:37:48 +0000 (13:37 +0200)]
GetBlockSize: Fall back to using BLCKSZ if block size determined was zero
If the first block of the file read is zeroed out, GetBlockSize would
return 0, and make DumpFileContents die with a non-helpful "Premature
end of file encountered" because fread() read only 0 bytes.
Christoph Berg [Sun, 2 Sep 2018 11:48:23 +0000 (13:48 +0200)]
Releasing pg_filedump 11.0
Christoph Berg [Sun, 2 Sep 2018 11:34:54 +0000 (13:34 +0200)]
Use sizeof(PageHeaderData) in place of pageHeaderSize
With -Werror=vla, gcc complains about the localCache declaration.
Instead of the pageHeaderSize variable, use sizeof(PageHeaderData)
directly like elsewhere in this file.
pg_filedump.c:648:2: error: ISO C90 forbids array ‘localCache’ whose
size can’t be evaluated [-Werror=vla]
Christoph Berg [Tue, 31 Jul 2018 10:04:58 +0000 (12:04 +0200)]
Fix parsing of charN and varcharN types
The type names are always converted to lower case. Fix the type lookup
table by using "charn" and "varcharn".
Report-By: coredumped on GitHub
Christoph Berg [Tue, 31 Jul 2018 09:26:26 +0000 (11:26 +0200)]
PG 11 removed prevCheckPoint from the control file
PG 11 no longer tracks the previous checkpoint location, so remove it
here. Unfortunately, this change means our pg_control parsing is not
cross-major compatible anymore, so in contrast to what we did in
3829a9b66c0, add #ifs to support older PG versions.
Christoph Berg [Wed, 20 Jun 2018 10:07:16 +0000 (12:07 +0200)]
pg_filedump 10.1
Christoph Berg [Wed, 20 Jun 2018 10:01:50 +0000 (12:01 +0200)]
Copyright bump for 2018
Christoph Berg [Wed, 20 Jun 2018 09:58:31 +0000 (11:58 +0200)]
Use pg_config in Makefile as well
Modify Makefile to use pg_config just like Makefile.contrib does.
In passing, set LIBS to $(libpq_pgport) to avoid linking pg_filedump
against all libs the server links to, we just need pgport.
Teodor Sigaev [Mon, 4 Dec 2017 14:15:32 +0000 (17:15 +0300)]
pg_filedump can dump toasted values (-t flag)
Alexey Chernyshov <
[email protected]>
Teodor Sigaev [Thu, 23 Nov 2017 16:12:52 +0000 (19:12 +0300)]
Fix reading of TOASTed length
Alexey Chernyshov <
[email protected]>
Teodor Sigaev [Thu, 23 Nov 2017 15:29:15 +0000 (18:29 +0300)]
Omit deleted tuple if flag -o is presented. Deleted tuples are
detected by Xmax != 0. Seems, nothing better without commit log.
Alexey Chernyshov <
[email protected]> with editorization by me
Teodor Sigaev [Thu, 23 Nov 2017 15:18:12 +0000 (18:18 +0300)]
pg_indent run
Alexey Chernyshov <
[email protected]>
Teodor Sigaev [Thu, 23 Nov 2017 15:08:47 +0000 (18:08 +0300)]
Fix list of object files in Makefile.contrib
Alexey Chernyshov <
[email protected]>
Christoph Berg [Sun, 22 Oct 2017 18:06:17 +0000 (20:06 +0200)]
Add list of types supported by -D to help output
Also fix a few typos, and fix indentation of help text.
Christoph Berg [Sun, 22 Oct 2017 17:48:05 +0000 (19:48 +0200)]
Bump copyright year to 2017
Christoph Berg [Sun, 22 Oct 2017 17:46:04 +0000 (19:46 +0200)]
Bump pg_filedump version to 10.0
Christoph Berg [Sun, 22 Oct 2017 17:16:24 +0000 (19:16 +0200)]
The control file does not contain enableIntTimes anymore
PG10 gets rid of controlData->enableIntTimes, remove it in pg_filedump
as well. We could add try adding #ifs to still show it for older major
versions, but given that pg_filedump is cross-version compatible for
dumping the recent major's control files except for this change, it
seems more prudent to simply remove it. We don't show other fields like
float4ByVal either, and pg_controldata is a better tool for control file
inspection anyway, so keep the logic in pg_filedump simple.
Teodor Sigaev [Wed, 1 Mar 2017 12:08:09 +0000 (15:08 +0300)]
Support decoding of catalog tables.
Support decoding of 'name' and 'char' types. Also introduce '~'
pseudo-type which just ignores all data left in current tuple during
decoding. These two types allow easily to decode catalog tables and
restore schema of a database even if it's corrupted and PostgreSQL
instance is not starting.
For instance, pg_attribute can be decoded like this:
pg_filedump -D oid,name,oid,int,smallint,~ path/to/segment/1249
Aleksander Alekseev
Teodor Sigaev [Tue, 17 Jan 2017 13:01:12 +0000 (16:01 +0300)]
Partial data recovery (-D flag).
This feature allows to partially recover data from a given segment file
in format suitable for using in COPY FROM statement. List of supported
data types is currently not full and TOAST is not yet supported, but
it's better than nothing. Hopefully data recovery will be improved in
the future.
Implemented by Aleksander Alekseev, reviewed by Dmitry Ivanov, tested
by Dmitry Ivanov and Grigoriy Smolkin.
Christoph Berg [Fri, 14 Oct 2016 09:23:57 +0000 (11:23 +0200)]
Get cflags/ldflags/bindir from pg_config and add install rule
Christoph Berg [Fri, 14 Oct 2016 09:15:58 +0000 (11:15 +0200)]
Don't set CC in the Makefile
Reported by Aleksander Alekseev
Christoph Berg [Fri, 14 Oct 2016 09:14:50 +0000 (11:14 +0200)]
After
8023b582 there is no more SizeOfIptrData macro
Aleksander Alekseev
Christoph Berg [Thu, 29 Sep 2016 11:24:49 +0000 (13:24 +0200)]
Bump version to 9.6.0