On Tue, Mar 13, 2018 at 05:19:50PM -0700, David G. Johnston wrote: > On Tue, Mar 13, 2018 at 5:11 PM, Tatsuo Ishii <is...@sraoss.co.jp> wrote: >> select pg_catalog.count(*) from pg_catalog.pg_namespace where >> pg_catalog.nameeq(nspname, '%s'); >> >> > I'd rather write that: > > select [...] where nspname operator(pg_catalog.=) '%s' > > Introducing undocumented implementation functions to these queries is > undesirable; and besides, indexing and equivalence relies on operators and > not the underlying functions so there would be some risk of performance > issues if the functions were used directly.
Using directly the function calls calls under the wood of what an operator does is a potential solution, though I would discard it as it becomes harder for the reader to undertand that this is an operator. Things become even more confusing when dealing with input parameters of different types for simple maths like addition, multiplication or division using several kinds of integers, leading to more complications in maintaining this code in the future. And the operator is careful about doing proper casting itself. -- Michael
Description: PGP signature