Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introspect comparison operators (#84)
### What Rather than dreaming up the comparison operators that can apply to each type we ask the database. ### How We introduce a new configuration field, `comparisonOperatorAliases`, which defines what names to expose database infix comparison operators under. This cannot be derived only from introspection. The default uses the names of graphql-engine v2. We filter how much of the introspection data ends up in the deployment and schema to include only types, comparison operators, and aggregation functions that are actually used in native queries or tables, in order to keep the size small and the contents concise and relevant. The operators are sourced from the catalog table `pg_operator`, because this is supported by both Postgres and CockroachDB. We could relatively easily extend our comparison operators to cover normal prefix predicates, but that is future work. Answering the question "which operators are defined for a given type" is a somewhat nuanced affair, since we have to take into account operator overloading and implicit casts. There is even the insular case of an operator (`SIMILAR TO` in Postgres) being defined as syntactic sugar over `LIKE`. Since `SIMILAR TO` is somewhat obscure (IMO) and not really very distinguished from LIKE and `REGEX`, I've opted not to try and have it appear automatically during configuration/introspection. (And any user who categorically needs to use it are free to define it themselves in the deployment) --------- Co-authored-by: Samir Talwar <[email protected]>
- Loading branch information