pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18135: Incorrect memory access occurs when attaching a partition with an index
Date: Sun, 01 Oct 2023 23:04:11 -0400
Message-ID: <1914031.1696215851@sss.pgh.pa.us> (raw)
In-Reply-To: <ZRoxY3X1tGZRZQ2A@paquier.xyz>
References: <18135-532f4a755e71e4d2@postgresql.org>
	<1043711.1695922299@sss.pgh.pa.us>
	<ZRi96-kUPFy0ILzb@paquier.xyz>
	<1614549.1696120777@sss.pgh.pa.us>
	<ZRoxY3X1tGZRZQ2A@paquier.xyz>

Michael Paquier <michael@paquier.xyz> writes:
> FWIW, I was thinking about a case like that with 2 index attributes:
> info1->attr[0] = 0, info1->attr[1] = 1
> info2->attr[0] = 1, info2->attr[1] = 0
> With a mapping from info2 to info1 like that:
> attmap[0] = 1, attmap[1] = 0.

> The code before 9f71e10d6 would have accessed an incorrect pointer.
> The new code would return false, which would not be correct if the
> expressions stored in ii_Expressions for info1/attr0 and info2/attr1
> match?

I think "false" is correct.  Otherwise you're claiming that an
index on (expr, col1) is equivalent to an index on (col1, expr).
Maybe it is equivalent for some purposes, but I don't think this
function has any business assuming that it is so for all purposes.

Also, the pre-existing comment clearly intends that false is
the proper result here:

     * might differ!)  Note that this implies that index columns that are
     * expressions appear in the same positions.  We will next compare the
     * expressions themselves.

The code just failed to enforce that fully.

			regards, tom lane





view thread (10+ messages)

Message-ID: <1914031.1696215851@sss.pgh.pa.us>
Permalink:  ../1914031.1696215851@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1914031.1696215851@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, michael@paquier.xyz, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18135: Incorrect memory access occurs when attaching a partition with an index
  In-Reply-To: <1914031.1696215851@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox