Hi!
If a user creates a malformed operator in theirs database, like:

```
create or replace function f (name, name) RETURNS boolean AS $$ begin
RETURN $1::text = $2::text; end; $$ LANGUAGE plpgsql;
CREATE OPERATOR public.!~ ( LEFTARG = name, RIGHTARG = name, FUNCTION = f);
```

then psql's meta-commands queries like \du stop working.

That's because the catalog misses operators for leftarg = name,
rightarg = name and oprname = '!~'.

I think this can be enhanced a little by schema-qualifying psql's
internal query.
While this issue is fully the user's fault, I think psql can still be
a little more conservative in operator selection, and work anyways.
PFA POC patch.


This is not a security issue, per:
https://www.postgresql.org/docs/current/app-psql.html says:

  If untrusted users have access to a database that has not adopted a secure
  schema usage pattern, begin your session by removing publicly-writable
  schemas from search_path.

-- 
Best regards,
Kirill Reshke

Attachment: v1-0001-Schema-qualify-psql-internal-query-operators.patch
Description: Binary data

Reply via email to