On Jun 19, 2011, at 4:56 PM, Florian Pflug wrote:
> Hm, it seems we either all have different idea about how such
> a pattern type would be be defined, or have grown so accustomed to
> pg's type system that we've forgotten how powerful it really
> is ;-) (For me, the latter is surely true...).
>
> I've now created a primitive prototype that uses a composite
> type for "pattern". That changes the input syntax for patterns
> (you need to enclose them in brackets), but should model all
> the implicit and explicit casting rules and operator selection
> correctly. It also uses "~~~" in place of "~", for obvious
> reasons and again without changing the casting and overloading
> rules.
Ew.
> The prototype defines
> text ~~~ text
> text ~~~ pattern
> pattern ~~~ text
> and can be found at end of this mail.
>
> With that prototype, *all* the cases (even unknown ~~~ unknown)
> work as today, i.e. all of the statements below return true
Florian++ Very nice, thanks!
I don't suppose there's a special quoting to be had for patterns? Perhaps one of these (modulo SQL parsing issues);
/pattern/ {pattern} qr/pattern/ qr'pattern' R/pattern/ R'pattern'
Mike bikeshed is scarlet,
David