postgresql/src
Tom Lane ac9099fc1d Fix confusion in SP-GiST between attribute type and leaf storage type.
According to the documentation, the attType passed to the opclass
config function (and also relied on by the core code) is the type
of the heap column or expression being indexed.  But what was
actually being passed was the type stored for the index column.
This made no difference for user-defined SP-GiST opclasses,
because we weren't allowing the STORAGE clause of CREATE OPCLASS
to be used, so the two types would be the same.  But it's silly
not to allow that, seeing that the built-in poly_ops opclass
has a different value for opckeytype than opcintype, and that if you
want to do lossy storage then the types must really be different.
(Thus, user-defined opclasses doing lossy storage had to lie about
what type is in the index.)  Hence, remove the restriction, and make
sure that we use the input column type not opckeytype where relevant.

For reasons of backwards compatibility with existing user-defined
opclasses, we can't quite insist that the specified leafType match
the STORAGE clause; instead just add an amvalidate() warning if
they don't match.

Also fix some bugs that would only manifest when trying to return
index entries when attType is different from attLeafType.  It's not
too surprising that these have not been reported, because the only
usual reason for such a difference is to store the leaf value
lossily, rendering index-only scans impossible.

Add a src/test/modules module to exercise cases where attType is
different from attLeafType and yet index-only scan is supported.

Discussion: https://postgr.es/m/3728741.1617381471@sss.pgh.pa.us
2021-04-04 14:28:57 -04:00
..
backend Fix confusion in SP-GiST between attribute type and leaf storage type. 2021-04-04 14:28:57 -04:00
bin Improve psql's behavior when the editor is exited without saving. 2021-04-03 17:38:31 -04:00
common Refactor HMAC implementations 2021-04-03 17:30:49 +09:00
fe_utils psql: call clearerr() just before printing 2021-03-29 18:34:39 -03:00
include Fix confusion in SP-GiST between attribute type and leaf storage type. 2021-04-04 14:28:57 -04:00
interfaces Refactor HMAC implementations 2021-04-03 17:30:49 +09:00
makefiles Remove libpq.rc, use win32ver.rc for libpq 2020-01-15 15:06:12 +01:00
pl Remove extra increment of plpgsql's statement counter for FOR loops. 2021-02-02 14:35:12 -05:00
port Move bsearch_arg to src/port 2021-03-23 00:11:22 +01:00
template Further tweaking of PG_SYSROOT heuristics for macOS. 2021-01-20 12:07:23 -05:00
test Fix confusion in SP-GiST between attribute type and leaf storage type. 2021-04-04 14:28:57 -04:00
timezone Update time zone data files to tzdata release 2021a. 2021-01-24 16:29:47 -05:00
tools Refactor HMAC implementations 2021-04-03 17:30:49 +09:00
tutorial tutorial: land height is "elevation", not "altitude" 2021-03-10 20:25:19 -05:00
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Introduce --with-ssl={openssl} as a configure option 2021-02-01 19:19:44 +09:00
Makefile.shlib Add PostgreSQL home page to --help output 2020-02-28 13:12:21 +01:00
nls-global.mk Add errhint_plural() function and make use of it 2021-03-31 09:16:25 +02:00