Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jE8UN-0006PE-2M for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2020 09:26:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jE8UK-0003NN-5d for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2020 09:26:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jE8UJ-0003N9-PU for pgsql-hackers@lists.postgresql.org; Tue, 17 Mar 2020 09:26:15 +0000 Received: from courriel.mines-paristech.fr ([77.158.173.149] helo=antispam-1.ensmp.fr) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jE8UG-0001E0-L4 for pgsql-hackers@postgresql.org; Tue, 17 Mar 2020 09:26:14 +0000 Received: from smtp-4.mines-paristech.fr (smtp-4.ensmp.fr [77.158.173.143]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by antispam-1.ensmp.fr (antispam.mines-paristech.fr) with ESMTPS id 9F8BD568FD; Tue, 17 Mar 2020 10:21:48 +0100 (CET) Received: from pseudo (sfr-16.cri.mines-paristech.fr [77.158.180.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp-4.mines-paristech.fr (Postfix) with ESMTPSA id 872CF2C0173; Tue, 17 Mar 2020 10:21:48 +0100 (CET) Date: Tue, 17 Mar 2020 10:21:48 +0100 (CET) From: Fabien COELHO X-X-Sender: fabien@pseudo To: Justin Pryzby cc: Alvaro Herrera , David Steele , pgsql-hackers@postgresql.org, "Bossart, Nathan" , Thomas Munro , Tom Lane Subject: Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*) In-Reply-To: <20200317031427.GU26184@telsasoft.com> Message-ID: References: <20200316214806.GQ26184@telsasoft.com> <20200316221736.GA15635@alvherre.pgsql> <20200317031427.GU26184@telsasoft.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="2056645051-630642772-1584433926=:17584" Content-ID: X-CLAMAV-SCAN: ok X-VRSPAM-SCORE: -100 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrudefgedguddvlecutefuodetggdotefrucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepfffhvffujgfkfhgfgggtsehmtderredtreejnecuhfhrohhmpefhrggsihgvnhcuvefqgffnjffquceotghovghlhhhosegtrhhirdgvnhhsmhhprdhfrheqnecukfhppeejjedrudehkedrudektddrvdegtdenucfrrghrrghmpehmohguvgepshhmthhpohhuth X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --2056645051-630642772-1584433926=:17584 Content-Type: text/plain; FORMAT=flowed; CHARSET=UTF-8 Content-Transfer-Encoding: 8BIT Content-ID: 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. --2056645051-630642772-1584433926=:17584--