Re: record identical operator - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: record identical operator
Date
Msg-id m28uyvd00x.fsf@2ndQuadrant.fr
Whole thread Raw
In response to Re: record identical operator  (Kevin Grittner <kgrittn@ymail.com>)
List pgsql-hackers
Kevin Grittner <kgrittn@ymail.com> writes:
>   =      equals (but doesn't necessarily look the same as)
>   ===    IS NOT DISTINCT FROM as an operator
>   ====   reserved for "has no user-visible differences from"
>   =====  stored image is the same

I understand the need for more than one equality operator and my
programming language of choice exposes eq, eql, equal and equalp for
solving a very similar situation. Oh, and also offers = and string= and
string-equal, among others.

My vote goes against using a different number of the same character to
name the operators though, as that's not visually helpful enough IMO.

In yet another language whose grammar took inspiration with Prolog,
dealing with binary is made with explicitely using the bit syntax
expression where any datum is boxed into << and >>.
 http://erlang.org/doc/reference_manual/expressions.html#id78513

It might not be practical to do the same in SQL and have either the
following syntax example or even a unary "bit representation" operator
to do the same:
 SELECT <<row(expression, here)>> = <<column_name>> …

That would probably prevent using indexes?

It might be inspiration to name the bit-comparison operator something
like <<=>> though, or =><= or something else. If only we could force the
usage of unicode for the SQL input itself… I'm sure there's a unicode
glyph perfect for what we want here…

About IS NOT DISTINCT FROM, I would propose something where NOT and
DISTINCT are kept as concepts. Not usually is expressed with ! and we
already have a bunch of "same as" or "matches" operators with ~, so:
 <~>   IS DISTINCT FROM !<~>  IS NOT DISTINCT FROM

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support



pgsql-hackers by date:

Previous
From: samthakur74
Date:
Subject: Re: pg_stat_statements: calls under-estimation propagation
Next
From: Hamid Quddus Akhtar
Date:
Subject: output/security_label.source referring to abs_builddir instead of libdir