pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix SP-GiST scan initialization logic for binary-compatible case 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix SP-GiST scan initialization logic for binary-compatible case @ 2021-11-20 19:30 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2021-11-20 19:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix SP-GiST scan initialization logic for binary-compatible cases. Commit ac9099fc1 rearranged the logic in spgGetCache() that determines the index's attType (nominal input data type) and leafType (actual type stored in leaf index tuples). Turns out this broke things for the case where (a) the actual input data type is different from the nominal type, (b) the opclass's config function leaves leafType defaulted, and (c) the opclass has no "compress" function. (b) caused us to assign the actual input data type as leafType, and then since that's not attType, we complained that a "compress" function is required. For non-polymorphic opclasses, condition (a) arises in binary-compatible cases, such as using SP-GiST text_ops for a varchar column, or using any opclass on a domain over its nominal input type. To fix, use attType for leafType when the index's declared column type is different from but binary-compatible with attType. Do this only in the defaulted-leafType case, to avoid overriding any explicit selection made by the opclass. Per bug #17294 from Ilya Anfimov. Back-patch to v14. Discussion: https://postgr.es/m/17294-8f6c7962ce877edc@postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/f4e7ae2b8a67ad6801726553a024a3306716ef80 Modified Files -------------- src/backend/access/spgist/spgutils.c | 12 ++++++++++++ src/test/regress/expected/spgist.out | 21 +++++++++++++++++++++ src/test/regress/sql/spgist.sql | 9 +++++++++ 3 files changed, 42 insertions(+) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix SP-GiST scan initialization logic for binary-compatible case @ 2021-11-20 19:30 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2021-11-20 19:30 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix SP-GiST scan initialization logic for binary-compatible cases. Commit ac9099fc1 rearranged the logic in spgGetCache() that determines the index's attType (nominal input data type) and leafType (actual type stored in leaf index tuples). Turns out this broke things for the case where (a) the actual input data type is different from the nominal type, (b) the opclass's config function leaves leafType defaulted, and (c) the opclass has no "compress" function. (b) caused us to assign the actual input data type as leafType, and then since that's not attType, we complained that a "compress" function is required. For non-polymorphic opclasses, condition (a) arises in binary-compatible cases, such as using SP-GiST text_ops for a varchar column, or using any opclass on a domain over its nominal input type. To fix, use attType for leafType when the index's declared column type is different from but binary-compatible with attType. Do this only in the defaulted-leafType case, to avoid overriding any explicit selection made by the opclass. Per bug #17294 from Ilya Anfimov. Back-patch to v14. Discussion: https://postgr.es/m/17294-8f6c7962ce877edc@postgresql.org Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6d07cbc509d83d299552c4155b3511cf71c67276 Modified Files -------------- src/backend/access/spgist/spgutils.c | 12 ++++++++++++ src/test/regress/expected/spgist.out | 21 +++++++++++++++++++++ src/test/regress/sql/spgist.sql | 9 +++++++++ 3 files changed, 42 insertions(+) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2021-11-20 19:30 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-11-20 19:30 pgsql: Fix SP-GiST scan initialization logic for binary-compatible case Tom Lane <tgl@sss.pgh.pa.us> 2021-11-20 19:30 pgsql: Fix SP-GiST scan initialization logic for binary-compatible case Tom Lane <tgl@sss.pgh.pa.us>
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