pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix assorted bugs by changing TS_execute's callback API to terna 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix assorted bugs by changing TS_execute's callback API to terna @ 2020-07-24 19:44 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2020-07-24 19:44 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix assorted bugs by changing TS_execute's callback API to ternary logic. Text search sometimes failed to find valid matches, for instance '!crew:A'::tsquery might fail to locate 'crew:1B'::tsvector during an index search. The root of the issue is that TS_execute's callback functions were not changed to use ternary (yes/no/maybe) reporting when we made the search logic itself do so. It's somewhat annoying to break that API, but on the other hand we now see that any code using plain boolean logic is almost certainly broken since the addition of phrase search. There seem to be very few outside callers of this code anyway, so we'll just break them intentionally to get them to adapt. This allows removal of tsginidx.c's private re-implementation of TS_execute, since that's now entirely duplicative. It's also no longer necessary to avoid use of CALC_NOT in tsgistidx.c, since the underlying callbacks can now do something reasonable. Back-patch into v13. We can't change this in stable branches, but it seems not quite too late to fix it in v13. Tom Lane and Pavel Borisov Discussion: https://postgr.es/m/CALT9ZEE-aLotzBg-pOp2GFTesGWVYzXA3=mZKzRDa_OKnLF7Mg@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/2f2007fbb255be178aca586780967f43885203a7 Modified Files -------------- src/backend/tsearch/wparser_def.c | 8 +- src/backend/utils/adt/tsginidx.c | 133 ++++++------------------------ src/backend/utils/adt/tsgistidx.c | 26 +++--- src/backend/utils/adt/tsrank.c | 12 ++- src/backend/utils/adt/tsvector_op.c | 147 ++++++++++++++++++++++------------ src/include/tsearch/ts_utils.h | 32 +++++--- src/test/regress/expected/tsearch.out | 144 +++++++++++++++++++++++++++++++++ src/test/regress/expected/tstypes.out | 49 ++++++++++++ src/test/regress/sql/tsearch.sql | 24 ++++++ src/test/regress/sql/tstypes.sql | 9 +++ 10 files changed, 395 insertions(+), 189 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix assorted bugs by changing TS_execute's callback API to terna @ 2020-07-24 19:44 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2020-07-24 19:44 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix assorted bugs by changing TS_execute's callback API to ternary logic. Text search sometimes failed to find valid matches, for instance '!crew:A'::tsquery might fail to locate 'crew:1B'::tsvector during an index search. The root of the issue is that TS_execute's callback functions were not changed to use ternary (yes/no/maybe) reporting when we made the search logic itself do so. It's somewhat annoying to break that API, but on the other hand we now see that any code using plain boolean logic is almost certainly broken since the addition of phrase search. There seem to be very few outside callers of this code anyway, so we'll just break them intentionally to get them to adapt. This allows removal of tsginidx.c's private re-implementation of TS_execute, since that's now entirely duplicative. It's also no longer necessary to avoid use of CALC_NOT in tsgistidx.c, since the underlying callbacks can now do something reasonable. Back-patch into v13. We can't change this in stable branches, but it seems not quite too late to fix it in v13. Tom Lane and Pavel Borisov Discussion: https://postgr.es/m/CALT9ZEE-aLotzBg-pOp2GFTesGWVYzXA3=mZKzRDa_OKnLF7Mg@mail.gmail.com Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/92fe6895d66da93a3c920089cfbbe4eb2db2145e Modified Files -------------- src/backend/tsearch/wparser_def.c | 8 +- src/backend/utils/adt/tsginidx.c | 133 ++++++------------------------ src/backend/utils/adt/tsgistidx.c | 26 +++--- src/backend/utils/adt/tsrank.c | 12 ++- src/backend/utils/adt/tsvector_op.c | 147 ++++++++++++++++++++++------------ src/include/tsearch/ts_utils.h | 32 +++++--- src/test/regress/expected/tsearch.out | 144 +++++++++++++++++++++++++++++++++ src/test/regress/expected/tstypes.out | 49 ++++++++++++ src/test/regress/sql/tsearch.sql | 24 ++++++ src/test/regress/sql/tstypes.sql | 9 +++ 10 files changed, 395 insertions(+), 189 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2020-07-24 19:44 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2020-07-24 19:44 pgsql: Fix assorted bugs by changing TS_execute's callback API to terna Tom Lane <tgl@sss.pgh.pa.us> 2020-07-24 19:44 pgsql: Fix assorted bugs by changing TS_execute's callback API to terna 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