patternsqlMinor
Use PostgreSQL builtin operator <@ after including extension intarray
Viewed 0 times
postgresqlafteroperatorintarrayextensionbuiltinincludinguse
Problem
I added the intarray extension to my PostgreSQL database in order to make use of the
The reason to prefer the builtin operator is that the builtin operator allows
- operator, but I still want to use the builtin <@ operator, not intarray's <@ operator. Is there a way to do this?The reason to prefer the builtin operator is that the builtin operator allows
NULL values in the array in question, whereas the intarray operator raises an error in the event of a NULL value.Solution
If you installed the
Instead of
you can write
to schema-qualify it.
e.g.
intarray extension to the public schema (or some schema other than pg_catalog), you can schema-qualify the operator to choose the built-in one.Instead of
a <@ byou can write
a OPERATOR(pg_catalog.<@) bto schema-qualify it.
e.g.
test=# SELECT 1 OPERATOR(pg_catalog.+) 2;
?column?
----------
3
(1 row)Code Snippets
a OPERATOR(pg_catalog.<@) btest=# SELECT 1 OPERATOR(pg_catalog.+) 2;
?column?
----------
3
(1 row)Context
StackExchange Database Administrators Q#110599, answer score: 3
Revisions (0)
No revisions yet.