Re: [PATCH v1] pg_ls_tmpdir to show directories

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, "Bossart, Nathan" <bossartn(at)amazon(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: [PATCH v1] pg_ls_tmpdir to show directories
Date: 2020-01-16 08:34:32
Message-ID: alpine.DEB.2.21.2001160927390.30419@pseudo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Justin,

>> I'm trying to think about how to get rid of the strange structure and hacks,
>> and the arbitrary looking size 2 array.
>>
>> Also the recursion is one step, but I'm not sure why, ISTM it could/should
>> go on always?
>
> Because tmpfiles only go one level deep.

I'm not sure it is a general rule. ISTM that extensions can use tmp files,
and we would have no control about what they would do there.

>> Looking at the code, ISTM that relying on a stack/list would be much cleaner
>> and easier to understand. The code could look like:
>
> I'm willing to change the implementation, but only after there's an agreement
> about the desired behavior (extra column, one level, etc).

For the level, ISTM that the implementation should not make this
assumption. If in practice there is just one level, then the function will
not recurse deep, no problem.

For the column, I'm not sure that "isdir" is necessary.

You could put it implicitely in the file name by ending it with "/",
and/or showing the directory contents is enough a hint that there is a
directory?

Also, I'm not fully sure why ".*" files should be skipped, maybe it should
be an option? Or the user can filter it with SQL if it does not want them?

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2020-01-16 08:56:01 Re: Setting min/max TLS protocol in clientside libpq
Previous Message Pavel Stehule 2020-01-16 07:57:32 Re: proposal: type info support functions for functions that use "any" type