Re: record identical operator

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Andres Freund <andres(at)2ndquadrant(dot)com>, Kevin Grittner <kgrittn(at)ymail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: record identical operator
Date: 2013-09-16 15:42:31
Message-ID: CAHyXU0z_KY_VwJGZK_V0yYYZm4rb8N40YZ=exqY7KaTppA7SLA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Sep 15, 2013 at 6:49 PM, Noah Misch <noah(at)leadboat(dot)com> wrote:
> On Sat, Sep 14, 2013 at 08:58:32PM +0200, Andres Freund wrote:
>> On 2013-09-14 11:25:52 -0700, Kevin Grittner wrote:
>> > Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
>> > > But both arrays don't have the same binary representation since
>> > > the former has a null bitmap, the latter not. So, if you had a
>> > > composite type like (int4[]) and would compare that without
>> > > invoking operators you'd return something false in some cases
>> > > because of the null bitmaps.
>> >
>> > Not for the = operator. The new "identical" operator would find
>> > them to not be identical, though.
>>
>> Yep. And I think that's a problem if exposed to SQL. People won't
>> understand the hazards and end up using it because its faster or
>> somesuch.
>
> The important question is whether to document the new operator and/or provide
> it under a guessable name. If we give the operator a weird name, don't
> document it, and put an "internal use only" comment in the catalogs, that is
> essentially as good as hiding this feature at the SQL level.
>
> I'm of two minds on that question. On the one hand, MV maintenance is hardly
> the first use case for an identity operator. Any replication system or user
> space materialized view implementation might want this. On the other hand,
> offering it for the record type exclusively is surprising. It's also
> surprising how records with different numbers of dropped columns can be found
> identical, even though a record column within the top-level record is not
> permitted to vary that way.
>
> Supposing a decision to document the operator, a second question is whether
> "===" is the right name:

I vote to reserve '===' as shorthand for 'IS NOT DISTINCT FROM' and
give the binary equality operator a funky name. I would document the
operator though.

merlin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2013-09-16 15:58:58 Re: record identical operator
Previous Message Andres Freund 2013-09-16 15:37:55 Re: Support for REINDEX CONCURRENTLY