Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM'

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM'
Дата
Msg-id CA+Tgmoap=pTvj4vRvTHsKOwbCGvuFNu-q=MV1d7qQhNXO8OYTA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Proposition to use '==' as synonym for 'IS NOT DISTINCT FROM'  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Mon, Oct 28, 2019 at 11:20 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > I mean, do we have to break the extensions? If we just added ==
> > operators that behaved like IS NOT DISTINCT FROM to each datatype, why
> > would anything get broken?
>
> Is that the proposal?  I certainly assumed that Eugen had in mind a
> parser-level hack, because adding dozens of new operators and their
> underlying functions would be a Lot Of Tedious Work.  But I agree
> that if we did it like that, it (probably) wouldn't break anything.

I'm not sure we've yet converged on a single proposal yet.  This seems
to be at the spitballing stage.

> I'd be somewhat inclined to adopt "===" and "!===" as the standard
> names, trading off one more keystroke to get to a point where we
> almost certainly aren't conflicting with anybody's existing usage.

Maybe.  It's an open question in my mind which of those is more likely
to be taken already.  Javascript uses === and !== for a certain kind
of equality comparison, so I'd guess that the chance of someone having
used === is better-than-average for that reason.  Also, if we decide
that the opposite of === is !=== rather than !==, someone may hate us.

> One objection to proceeding like that is that there'd be no
> visible connection between a datatype's "=" and "===" operators,
> removing any hope of someday optimizing, for example, "x IS NOT
> DISTINCT FROM 42" into an indexscan on x.  We're certainly not
> very bright about these constructs today, but at least there
> exists the possibility of doing better in future.  I suppose
> we could think about extending btree opclasses to allow for
> an === entry, but that'd be another pile of work ...

Yeah.  If we went this route, I think we'd probably have to do that
extension of the btree operator class machinery first. Virtually
nobody is gonna want a new spelling of IS NOT DISTINCT FROM that is
shorter but performs terribly.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: WIP/PoC for parallel backup
Следующее
От: Vik Fearing
Дата:
Сообщение: Re: WIP: System Versioned Temporal Table