Contents
pg_operator_is_visible()
A function for determining whether an operator is visible in the current search path
pg_operator_is_visible()
is a system function for determining whether an operator is visible in the current search path
pg_operator_is_visible()
was added in PostgreSQL 7.3.
Usage
pg_operator_is_visible (operator
oid
) →boolean
The operator
parameter can be provided as a text value with the regoperator
OID alias containing the operator's name. In this case the name should be provided as a schema-qualified value (e.g. "someschema.someoperator
"), otherwise an ERROR
will be raised if the operator exists but is not visible in the current search path.
Change history
- PostgreSQL 7.3
- added (commit 4ab8e690)
Examples
Example usage for pg_operator_is_visible()
, assuming the hstore extension has been installed into the hstore
schema:
postgres=# \do hstore.%* List of operators Schema | Name | Left arg type | Right arg type | Result type | Description --------+------+---------------+----------------+-------------+------------- hstore | %# | | hstore.hstore | text[] | hstore | %% | | hstore.hstore | text[] | (2 rows) postgres=# SHOW search_path; search_path ----------------- "$user", public (1 row) postgres=# SELECT pg_operator_is_visible('hstore.%#(NONE,hstore.hstore)'::regoperator); pg_operator_is_visible ------------------------ f (1 row) postgres=# SET search_path TO hstore; SET postgres=# SELECT pg_operator_is_visible('hstore.%#(NONE,hstore.hstore)'::regoperator); pg_operator_is_visible ------------------------ t (1 row)
An ERROR
will be raised if the operator does not exist, or exists but is not schema-qualified and not in the current search path:
postgres=# SELECT pg_operator_is_visible('@@@(NONE,int)'::regoperator); ERROR: operator does not exist: @@@(NONE,int) LINE 1: SELECT pg_operator_is_visible('@@@(NONE,int)'::regoperator); ^ postgres=# SHOW search_path; search_path ----------------- "$user", public (1 row) postgres=# SELECT pg_operator_is_visible('%#(NONE,hstore.hstore)'::regoperator); ERROR: operator does not exist: %#(NONE,hstore.hstore) LINE 1: SELECT pg_operator_is_visible('%#(NONE,hstore.hstore)'::rego...
References
- PostgreSQL documentation: Schema Visibility Inquiry Functions
Categories
See also
pg_opclass_is_visible(), pg_opfamily_is_visible()