Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*)

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, David Steele <david(at)pgmasters(dot)net>, pgsql-hackers(at)postgresql(dot)org, "Bossart, Nathan" <bossartn(at)amazon(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*)
Date: 2020-06-07 08:07:19
Message-ID: alpine.DEB.2.22.394.2006070908120.32228@pseudo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Justin,

> Rebased onto 7b48f1b490978a8abca61e9a9380f8de2a56f266 and renumbered OIDs.

Some feedback about v18, seen as one patch.

Patch applies cleanly & compiles. "make check" is okay.

pg_stat_file() and pg_stat_dir_files() now return a char type, as well as
the function which call them, but the documentation does not seem to say
that it is the case.

I must admit that I'm not a fan on the argument management of
pg_ls_dir_metadata and pg_ls_dir_metadata_1arg and others. I understand
that it saves a few lines though, so maybe let it be.

There is a comment in pg_ls_dir_files which talks about pg_ls_dir.

Could pg_ls_*dir functions C implementations be dropped in favor of a pure
SQL implementation, like you did with recurse?

If so, ISTM that pg_ls_dir_files() could be significantly simplified by
moving its filtering flag to SQL conditions on "type" and others. That
could allow not to change the existing function output a keep the "isdir"
column defined as "type = 'd'" where it was used previously, if someone
complains, but still have the full capability of "ls". That would also
allow to drop the "*_1arg" hacks. Basically I'm advocating having 1 or 2
actual C functions, and all other variants managed at the SQL level.

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michail Nikolaev 2020-06-07 08:24:50 Re: Improving connection scalability: GetSnapshotData()
Previous Message Thomas Munro 2020-06-07 08:07:10 Re: TAP tests not enabled in pg_dump