summaryrefslogtreecommitdiff
path: root/decode.c
AgeCommit message (Collapse)Author
2025-04-15Read toast chunks in ascending order, looping if requiredChristoph Berg
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 <myon@debian.org> Debugging-By: Svetlana Derevyanko <s.derevyanko@postgrespro.ru>
2025-04-15Print toast message only for matching toast chunksChristoph Berg
When dumping toasted values in verbose mode, show "Read TOAST chunk" message only for toast chunks that matched the Oid we are looking for.
2025-04-15Fix a typo in commentChristoph Berg
2025-04-15Use PRIu64 to format integersChristoph Berg
PG18 gets rid of INT64_MODIFIER, move to standard C version.
2025-04-15Fixed bug with number of digits for numeric being calculated wrong, which ↵Svetlana Derevyanko
led to outputting junk data. Close #32.
2024-06-07Move "number of chunks" to TOAST messageChristoph Berg
No reason to waste two separate lines on this.
2024-06-06Print type of toast when not decoding itChristoph Berg
2024-06-06Allow finding the toast table in current directoryChristoph Berg
get_parent_directory() returns "" when there is no directory part; replace that by ".".
2024-06-06Replace static buffers with mallocChristoph Berg
Since we learned to decode TOASTed values these buffers were too small.
2024-06-04Fixed unaligned use of struct NumericData, which could cause problems on ↵Svetlana Derevyanko
some systems. Close #29.
2023-09-14Decode oid/xid >= 2^31 correctlyChristoph Berg
Spotted by alexandervpotapov. Close #18.
2023-09-14Add support for PostgreSQL v16Karina Litskevich
2023-08-28Bugfix: make sure fclose is called with a legal argumentKarina Litskevich
fclose(NULL) is an UB
2023-08-28Bugfix: free dynamically allocated memoryKarina Litskevich
2022-03-30Decode timestamptzChristoph Berg
We unconditionally use +00 on output.
2022-03-30Decode date and timestamp infinity valuesChristoph Berg
2022-03-16Fix alignment handling of int64-based types, and of nameChristoph Berg
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.
2021-10-14Adding numeric type supportSvetlana Derevyanko
Added numeric type support. Move data decompression, detoasting and aligning into separated function to avoid redundancy.
2021-09-29Renamed decompressed_size into compressed_size according to actual meaning.Svetlana Derevyanko
2021-09-29Add support for PostgreSQL v14Svetlana Derevyanko
Add conditional compilation for changed structure members and macro. Add lz4 compression support.
2020-11-02decode.c: Fix int64 format strings for 32 bit architecturesChristoph Berg
2020-10-27Fix compilation on PG13Christoph Berg
2019-11-28Add support for PostgreSQL v12Guillaume Lelarge
2018-07-31Fix parsing of charN and varcharN typesChristoph Berg
The type names are always converted to lower case. Fix the type lookup table by using "charn" and "varcharn". Report-By: coredumped on GitHub
2017-12-04pg_filedump can dump toasted values (-t flag)Teodor Sigaev
Alexey Chernyshov <a.chernyshov@postgrespro.ru>
2017-11-23Fix reading of TOASTed lengthTeodor Sigaev
Alexey Chernyshov <a.chernyshov@postgrespro.ru>
2017-11-23pg_indent runTeodor Sigaev
Alexey Chernyshov <a.chernyshov@postgrespro.ru>
2017-03-01Support decoding of catalog tables.Teodor Sigaev
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
2017-01-17Partial data recovery (-D flag).Teodor Sigaev
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.