Allow finding the toast table in current directory
authorChristoph Berg <myon@debian.org>
Thu, 6 Jun 2024 14:21:02 +0000 (16:21 +0200)
committerChristoph Berg <myon@debian.org>
Thu, 6 Jun 2024 14:21:02 +0000 (16:21 +0200)
get_parent_directory() returns "" when there is no directory part;
replace that by ".".

decode.c

index 12200802338cd5d1e6c8a48365733bdc429d1933..2bbacb46e0d014ff96c70259cb377eade57762ca 100644 (file)
--- a/decode.c
+++ b/decode.c
@@ -1371,7 +1371,8 @@ ReadStringFromToast(const char *buffer,
                /* Open TOAST relation file */
                toast_relation_path = strdup(fileName);
                get_parent_directory(toast_relation_path);
-               sprintf(toast_relation_filename, "%s/%d", toast_relation_path,
+               sprintf(toast_relation_filename, "%s/%d",
+                               *toast_relation_path ? toast_relation_path : ".",
                                toast_ptr.va_toastrelid);
                printf("  Read TOAST relation %s\n", toast_relation_filename);
                toast_rel_fp = fopen(toast_relation_filename, "rb");