I'm running to this problem and haven't found any information related to it. On the same Postgres server (version 13.2), the below query works in one database, but is giving "ERROR: operator does not exist: jsonb & jsonb" in another database.
select jsonb_agg('{"a": "b", "c": "d"}'::jsonb - 'a');
This is the full error output:
ERROR: operator does not exist: jsonb & jsonb
LINE 1: SELECT json_cur_in & json_next_in
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
QUERY: SELECT json_cur_in & json_next_in
CONTEXT: PL/pgSQL function jsonb_agg_statef(jsonb,jsonb) line 3 at assignment
SQL state: 42883
The select query above is a simplified example, not the actual code. But it shows the same error. The jsonb_agg is the built-in function.
Any help is greatly appreciated.
jsonb_aggand overload the function? Inpsql\df *.jsonb_aggwill show you the latter. The system supplied should have a line like:pg_catalog | jsonb_agg | jsonb | anyelement | agg&operator forjsonb, so I'm guessing someone has been getting inventive.jsonb_agg_statefin the querySELECT json_cur_in & json_next_in. That is not going to work as again there is no&operator forjsonb.