Re: Incorrect comment in get_partition_dispatch_recurse - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Incorrect comment in get_partition_dispatch_recurse
Date
Msg-id 20180517200337.dclqyowwpw4c3tzj@alvherre.pgsql
Whole thread Raw
In response to Re: Incorrect comment in get_partition_dispatch_recurse  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2018-May-17, Tom Lane wrote:

> Robert Haas <robertmhaas@gmail.com> writes:
> > Hang on, I can't be wrong (famous last words).  If the negative
> > indexes were 0-based, that would mean that the first element of the
> > list was referenced by -0, which obviously can't be true, because 0 =
> > -0.  In other words, we can't be using 0-based indexing for both the
> > positive and the negative values, because then 0 itself would be
> > ambiguous.  It's got to be that -1 is the first element of the *pds
> > list, which means -- AFAICS, anyway -- that the way I phrased it is
> > correct.

> Maybe what you need is a redesign.  This convention seems impossibly
> confusing and hence error-prone.  What about using a separate bool to
> indicate which list the index refers to?

That was my impression I first came across this, FWIW, and I confess I
didn't try hard enough to understand it fully.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Problem while updating a foreign table pointing to a partitionedtable on foreign server
Next
From: Peter Eisentraut
Date:
Subject: Re: Odd procedure resolution