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

From Dave Page
Subject Re: [HACKERS] pg_ls_waldir() & pg_ls_logdir()
Date
Msg-id CA+OCxowSMcLRK26ydmE4G5UBULXEnmzrNqjYr9f+Y3H1dvTSDw@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] pg_ls_waldir() & pg_ls_logdir()  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Thu, Mar 16, 2017 at 7:05 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> 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.

Thanks!

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: [HACKERS] Partitioned tables and relfilenode
Next
From: Kuntal Ghosh
Date:
Subject: Re: [HACKERS] Two phase commit in ECPG