Re: pg_ls_waldir() & pg_ls_logdir()
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Dave Page <dpage@pgadmin.org>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2017-03-16T19:05:11Z
Lists: pgsql-hackers
On Thu, Mar 16, 2017 at 6:09 AM, Dave Page <dpage@pgadmin.org> wrote: > Hmm, good point. Google seems to be saying there isn't one. Patch > updated as you suggest (and I've added back in a function declaration > that got lost in the rebasing of the last version). OK, I took another look at this: - The documentation wasn't consistent with itself about the order in which the three columns were mentioned. I changed it to say name, size, modification time both places and made the code also return the columns in that order. And I renamed the columns to name, size, and modification, the last of which was chosen to match pg_stat_file(). - I added an error check for the stat() call. - I moved the code to genfile.c where pg_ls_dir() already is; it seems to fit within the charter of that file. - I changed it to build a heap tuple directly instead of converting to text and then back to datums. Seems less error-prone that way, and more consistent with what's done elsewhere in genfile.c. - I made it use a static-allocated buffer instead of a palloc'd one, just so it doesn't leak into the surrounding context. - I removed the function prototype and instead declared the helper function static. If there's an intent to expose that function to extensions, the prototype should be in a header, not the .c file. - I adjusted the language in the documentation to be a bit more similar to what we've done elsewhere. With those changes, committed. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Add pg_ls_logdir() and pg_ls_waldir() functions.
- befd73c50f11 10.0 landed