Dmitry Dolgov <9erthalion6@gmail.com> writes:
> Does anyone know, why `typcategory` value for tsvector `regconfig` is
> `TYPCATEGORY_NUMERIC`,
Because OID is. I think we need all the OID-alias types to be the same
category as OID, else we're likely to have issues with queries like
... where oid = 'foo'::regwhatever
It's conceivable that we could move OID and all the reg* types into
their own category, but then the other time-honored locution of
... where oid = 25
would possibly give issues.
> It's probably not a big deal, but in this thread [1] it prevents me from
> adopting the nice solution with a boolean flag for `to_tsvector` function,
> because Postgres can't distinguish between `to_tsvector(regconfig, text)` and
> `to_tsvector(jsonb, boolean)` in the expression:
We are *not* putting these in category string. They are not strings.
Furthermore, if we did so because
> ... then everything will be fine,
> since a string type will win.
then the odds are very good that these types would start to "win" some
other cases that we'd rather they didn't.
> Also, it doesn't break any existing tests
Doesn't prove a thing. We do not have a suite of test cases exercising
whether the type resolution code will avoid doing the wrong thing.
I think you need to bite the bullet and just provide the flag in
the 3-argument case (regconfig,json[b],bool).
regards, tom lane