Bug PoC below. Reported in https://www.postgresql.org/message-id/CABEVAa1dU0mDCAfaT8WF2adVXTDsLVJy_izotg6ze_hh-cn8qQ%40mail.gmail.com and fixed in https://www.postgresql.org/message-id/23800.1580509696%40sss.pgh.pa.us
This is correct:
> select json_to_tsvector('"abc"'::json, '"string"')
json_to_tsvector
--
'abc':1
Here, we changed the type name from "string"
to "strinA"
:
> select json_to_tsvector('"abc"'::json, '"strinA"')
json_to_tsvector
--
'abc':1
But it should crash like this one:
> select json_to_tsvector('"abc"'::json, '"stringX"')
Query Error: error: wrong flag in flag array: "stringX"
The same bug applies to the jsonb_to_tsvector
function.