Re: Does Type Have = Operator?

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Does Type Have = Operator?
Дата
Msg-id CAKFQuwZ_CmD=z8XNQZ4_FY7PkBqTTBXx6Jya-so=+ngNGPh3Ag@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Does Type Have = Operator?  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: Does Type Have = Operator?  (Kevin Grittner <kgrittn@gmail.com>)
Список pgsql-hackers
On Wed, May 11, 2016 at 9:54 AM, Robert Haas <robertmhaas@gmail.com> wrote:
On Tue, May 10, 2016 at 9:16 PM, David G. Johnston
<david.g.johnston@gmail.com> wrote:
> Brute force: you'd have to query pg_amop and note the absence of a row with
> a btree (maybe hash too...) family strategy 3 (1 for hash) [equality] where
> the left and right types are the same and match the type in question.

The core system uses this kind of thing to find equality operators in
a number of cases.

We often assume that the operator which implements equality for the
type's default btree operator class is the canonical one for some
purpose.  Ditto for the default hash operator class.

​Yeah, the user-facing documentation covers it pretty deeply if not in one central location.

But apparently the core system also uses the fact that "=", if present, is an equality operator and, less so, that no other operator is expected​
 
​to be used for equality.

I suspect that such an expectation is not enforced though - e.g., someone could define "==" to mean equality ​if they so choose (the lesser property).  Its hard to imagine defining "=" to mean something different in logic, though, without intentionally trying to be cryptic.

David J.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Josh berkus
Дата:
Сообщение: Re: Academic help for Postgres
Следующее
От: Kevin Grittner
Дата:
Сообщение: Re: Does Type Have = Operator?