On Fri, Oct 06, 2006 at 11:54:51 -0400, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> The problem with regex is that to be upward-compatible with the old
> exact-match switch definitions, a switch value that doesn't contain
> any regex special characters is treated as an equality condition not
> a pattern, which makes for a discontinuity. For instance, "-t x" is
> treated like -t '^x$' while -t 'x.*y' doesn't get the anchors added.
> That's going to burn people. An alternative we could consider is to
> use LIKE patterns instead, but since underscore is a wildcard in LIKE,
> it's easy to imagine people getting burnt by that too. Or we could
> import the rather ad-hoc shell-wildcard-like rules used by psql's \d
> stuff. None of these are especially attractive :-(
>
> Comments?
How about making the regex's anchored by default? People who want unanchored
ones can add .* at the beginning and/or end. Since only whether or not
the pattern matches is important (not the string it matched), this keeps
all of the same power, but matches the old behavior in simple cases.