Mark Dilger <markdil...@yahoo.com> writes:
> 4) Other places in the PostgreSQL sources where directory
> iteration is needed should probably use a pattern if possible
> when running on Windows.  Thus, it might make more
> sense to have a version of ReadDir that explicitly takes a
> pattern, and use that version of ReadDir elsewhere in the
> codebase.

Yeah, I think a separate argument passed to an AllocateDir variant
would be a less ugly way to deal with this.  For example, in place
of your first #ifdef block just write

        temp_dir = AllocateDirWithFilePattern(tmpdirname,
                                              PG_TEMP_FILE_PREFIX "*");


What is not immediately obvious to me is whether we should try to make
the pattern argument do something useful on non-Windows platforms
(and thus allow removal of the ad-hoc pattern match code in the loops
where this is used); versus just treating it as a no-op on non-Windows.
If we did that, we'd have to consider that Windows gets to define what
the pattern language is and try to emulate that; which is likely to be
expensive enough to not be a win, not to mention that non-Windows
developers might not be terribly familiar with the finer points of the
pattern language.

I'm kind of inclined to consider that we should just treat the pattern
option as a Windows-specific wart and keep the ad-hoc matching code as
it is.

                        regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to