pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Geoghegan <pg@bowt.ie>
Cc: pgsql-hackers@lists.postgresql.org, Pavel Borisov <pashkin.elfe@gmail.com>
Subject: Re: SP-GiST confusion: indexed column's type vs. index column type
Date: Sun, 04 Apr 2021 14:40:01 -0400
Message-ID: <252440.1617561601@sss.pgh.pa.us> (raw)
In-Reply-To: <3728741.1617381471@sss.pgh.pa.us>
References: <3728741.1617381471@sss.pgh.pa.us>

I wrote:
> I propose changing things so that
> (B) We enforce that leafType agrees with the opclass opckeytype,
> ensuring the index tupdesc can be used for leaf tuples.

After looking at PostGIS I realized that a hard restriction of this
sort won't fly, because it'd make upgrades impossible for them.
They have some lossy SPGiST opclasses, in which leafType is returned
as different from the original input datatype.  Since up to now
we've disallowed the STORAGE clause for user-defined SPGiST
opclasses, they are unable to declare these opclasses honestly in
existing releases, but it didn't matter.  If we enforce that STORAGE
matches leafType then their existing opclass definitions won't work
in v14, but they can't fix them before upgrading either.

So I backed off the complaint about that to be just an amvalidate
warning, and pushed it.

This means the INCLUDE patch will still have to account for the
possibility that the index tupdesc is an inaccurate representation
of the actual leaf tuple contents, but we can treat that case less
efficiently without feeling bad about it.  So we should be able to
do something similar for the leaf tupdesc as for the index-only-scan
output tupdesc, that is use the relcache's tupdesc if it's got the
right first column type, otherwise copy-and-modify that tupdesc.

			regards, tom lane





view thread (7+ messages)

Message-ID: <252440.1617561601@sss.pgh.pa.us>
Permalink:  ../252440.1617561601@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/252440.1617561601@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pg@bowt.ie, pashkin.elfe@gmail.com
  Subject: Re: SP-GiST confusion: indexed column's type vs. index column type
  In-Reply-To: <252440.1617561601@sss.pgh.pa.us>
  References: <3728741.1617381471@sss.pgh.pa.us> <252440.1617561601@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