Re: [HACKERS] pg_ls_waldir() & pg_ls_logdir() - Mailing list pgsql-hackers

From Robert Haas
Subject Re: [HACKERS] pg_ls_waldir() & pg_ls_logdir()
Date
Msg-id CA+Tgmoag9h2LtPtwFRMnZgryeYSiRLEydkSJpdrsdLF6-tdatA@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] pg_ls_waldir() & pg_ls_logdir()  (Dave Page <dpage@pgadmin.org>)
Responses Re: [HACKERS] pg_ls_waldir() & pg_ls_logdir()  (Dave Page <dpage@pgadmin.org>)
List 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



pgsql-hackers by date:

Previous
From: Denish Patel
Date:
Subject: Re: [HACKERS] Monitoring roles patch
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] Parallel Bitmap scans a bit broken