Re: [PATCH v1] pg_ls_tmpdir to show directories - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: [PATCH v1] pg_ls_tmpdir to show directories
Date
Msg-id alpine.DEB.2.21.1912280747370.27864@pseudo
Whole thread Raw
In response to Re: [PATCH v1] pg_ls_tmpdir to show directories  (Justin Pryzby <pryzby@telsasoft.com>)
Responses Re: [PATCH v1] pg_ls_tmpdir to show directories
List pgsql-hackers
Hello Justin,

>> Why not simply showing the files underneath their directories?
>>
>>   /path/to/tmp/file1
>>   /path/to/tmp/subdir1/file2
>>
>> In which case probably showing the directory itself is not useful,
>> and the is_dir column could be dropped?
>
> The names are expected to look like this:
>
> $ sudo find /var/lib/pgsql/12/data/base/pgsql_tmp -ls
> 142977    4 drwxr-x---   3 postgres postgres     4096 Dec 27 13:51 /var/lib/pgsql/12/data/base/pgsql_tmp
> 169868    4 drwxr-x---   2 postgres postgres     4096 Dec  7 01:35
/var/lib/pgsql/12/data/base/pgsql_tmp/pgsql_tmp11025.0.sharedfileset
> 169347 5492 -rw-r-----   1 postgres postgres  5619712 Dec  7 01:35
/var/lib/pgsql/12/data/base/pgsql_tmp/pgsql_tmp11025.0.sharedfileset/0.0
> 169346 5380 -rw-r-----   1 postgres postgres  5505024 Dec  7 01:35
/var/lib/pgsql/12/data/base/pgsql_tmp/pgsql_tmp11025.0.sharedfileset/1.0
>
> I think we'd have to show sudbdir/file1, subdir/file2, not just file1, file2.
> It doesn't seem useful or nice to show a bunch of files called 0.0 or 1.0.
> Actually the results should be unique, either on filename or (dir,file).

Ok, so this suggests recursing into subdirs, which requires to make a 
separate function of the inner loop.

> It's worth thinking if subdir should be a separate column.

My 0.02 €: I would rather simply keep the full path and just add subdir 
contents, so that the function output does not change at all.

-- 
Fabien.

pgsql-hackers by date:

Previous
From: Abdul Yadi AH-2
Date:
Subject: PostgreSQL 12.1 patch for "private_modify" table creation option fordata validation reinforcement
Next
From: Justin Pryzby
Date:
Subject: Re: [PATCH v1] pg_ls_tmpdir to show directories