Robert Schreiber <bobschreiber@charter.net> writes:
> Just to be clear here. It seems to me that I am right in that the
> leading/trailing Q should NOT be returned...
Nope. The SQL spec's pretty clear that when the first and third
sub-expressions of the pattern can match variable amounts of text,
they're supposed to be matched to the minimum possible amount of text,
which is nothing for a pattern like "Q?". It is a bug that we're
not doing that as the spec says, but once we fix that, it still won't
act as you're hoping.
regards, tom lane