Re: pg_ls_waldir() & pg_ls_logdir()

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_ls_waldir() & pg_ls_logdir()
Date: 2017-03-17 09:00:51
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

On Thu, Mar 16, 2017 at 7:05 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Thu, Mar 16, 2017 at 6:09 AM, Dave Page <dpage(at)pgadmin(dot)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.


Dave Page
Twitter: @pgsnake

EnterpriseDB UK:
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kuntal Ghosh 2017-03-17 09:17:56 Re: [HACKERS] Two phase commit in ECPG
Previous Message Amit Langote 2017-03-17 08:57:23 Re: Partitioned tables and relfilenode