Allow for case sensitive or insensitive pattern matches
Expose file mtime and ctime as timestamps
This PR adds four more options to FilesystemFdw:
escape_pattern (default: TRUE)
If TRUE, the pattern used to match files is escaped before it is
used for regular expression matching. If FALSE, the pattern used to
match files is used as is and it is assumed to be a valid regular
expression.
ignore_case (default: FALSE)
If FALSE, the pattern used to match files is case sensitive. If
TRUE, the pattern used to match files is case insensitive.
mtime_column
If set, defines which column will contain the file mtime.
ctime_column
If set, defines which column will contain the file ctime.
With this PR, the following example is supported:
> ls -R1 f
f:
taz
f/taz:
a_b.jpeg
a_b.JPEG
a-b.jpg
a_b.png
a b.PNG
filename | mtime | ctime | foo | bar | taz
----------+---------------------+---------------------+-----+-----+-----
a_b.jpeg | 2018-04-19 18:37:06 | 2018-04-20 19:20:12 | a | b | taz
a_b.png | 2018-04-19 18:37:04 | 2018-04-20 19:20:12 | a | b | taz
a-b.jpg | 2018-04-19 18:37:30 | 2018-04-20 19:20:12 | a | b | taz
a_b.JPEG | 2018-04-19 18:37:09 | 2018-04-20 19:20:12 | a | b | taz
a b.PNG | 2018-04-19 18:37:15 | 2018-04-20 19:20:12 | a | b | taz
(5 rows)
Notice the regular expression used for the pattern option which allows for the foo and bar tokens to be separated by `,_, or-. Also, the file extensions can be.jpg,.jpeg, or.png`, case insensitive.
Highlights:
pattern
optionThis PR adds four more options to
FilesystemFdw
:escape_pattern
(default:TRUE
) If TRUE, the pattern used to match files is escaped before it is used for regular expression matching. If FALSE, the pattern used to match files is used as is and it is assumed to be a valid regular expression.ignore_case
(default:FALSE
) If FALSE, the pattern used to match files is case sensitive. If TRUE, the pattern used to match files is case insensitive.mtime_column
If set, defines which column will contain the file mtime.ctime_column
If set, defines which column will contain the file ctime.With this PR, the following example is supported:
Notice the regular expression used for the
pattern
option which allows for thefoo
andbar
tokens to be separated by`,
_, or
-. Also, the file extensions can be
.jpg,
.jpeg, or
.png`, case insensitive.Fix for #203