About v13, seens as one patch:

Function "pg_ls_dir_metadata" documentation suggests a variable number of arguments with brackets, but parameters are really mandatory.

 postgres=# SELECT pg_ls_dir_metadata('.');
 ERROR:  function pg_ls_dir_metadata(unknown) does not exist
 LINE 1: SELECT pg_ls_dir_metadata('.');
               ^
 HINT:  No function matches the given name and argument types. You might need 
to add explicit type casts.
 postgres=# SELECT pg_ls_dir_metadata('.', true, true);
 …

The example in the documentation could be better indented. Also, ISTM that there are two implicit laterals (format & pg_ls_dir_recurse) that I would make explicit. I'd use the pcs alias explicitely. I'd use meaningful aliases (eg ts instead of b, …).

On reflection, I think that a boolean "isdir" column is a bad idea because it is not extensible. I'd propose to switch to the standard "ls" approach of providing the type as one character: '-' for regular, 'd' for directory, 'l' for link, 's' for socket, 'c' for character special…

ISTM that "lstat" is not available on windows, which suggests to call "stat" always, and then "lstat" on un*x and pg ports stuff on win.

I'm wondering about the restriction on directories only. Why should it not work on a file? Can it be easily extended to work on a simple file? If so, it could be just "pg_ls".

--
Fabien.

Reply via email to