postgresql/src/backend
David Rowley e502150f7d Allow Memoize to operate in binary comparison mode
Memoize would always use the hash equality operator for the cache key
types to determine if the current set of parameters were the same as some
previously cached set.  Certain types such as floating points where -0.0
and +0.0 differ in their binary representation but are classed as equal by
the hash equality operator may cause problems as unless the join uses the
same operator it's possible that whichever join operator is being used
would be able to distinguish the two values.  In which case we may
accidentally return in the incorrect rows out of the cache.

To fix this here we add a binary mode to Memoize to allow it to the
current set of parameters to previously cached values by comparing
bit-by-bit rather than logically using the hash equality operator.  This
binary mode is always used for LATERAL joins and it's used for normal
joins when any of the join operators are not hashable.

Reported-by: Tom Lane
Author: David Rowley
Discussion: https://postgr.es/m/3004308.1632952496@sss.pgh.pa.us
Backpatch-through: 14, where Memoize was added
2021-11-24 10:06:59 +13:00
..
access Be more specific about OOM in XLogReaderAllocate 2021-11-22 13:43:43 -03:00
bootstrap Fix bogus assertion in BootstrapModeMain(). 2021-08-09 08:28:53 -07:00
catalog Add SQL functions to monitor the directory contents of replication slots 2021-11-23 19:29:42 +09:00
commands Allow Memoize to operate in binary comparison mode 2021-11-24 10:06:59 +13:00
executor Allow Memoize to operate in binary comparison mode 2021-11-24 10:06:59 +13:00
foreign Improve HINT message that FDW reports when there are no valid options. 2021-10-27 00:46:52 +09:00
jit Avoid some other O(N^2) hazards in list manipulation. 2021-11-01 16:24:39 -04:00
lib Fix typo in comment 2021-04-20 14:35:16 +02:00
libpq Provide a variant of simple_prompt() that can be interrupted by ^C. 2021-11-17 19:09:54 -05:00
main process startup: Split single user code out of PostgresMain(). 2021-09-17 19:56:47 -07:00
nodes Allow Memoize to operate in binary comparison mode 2021-11-24 10:06:59 +13:00
optimizer Allow Memoize to operate in binary comparison mode 2021-11-24 10:06:59 +13:00
parser Rename some enums to use TABLE instead of REL. 2021-11-09 08:39:33 +05:30
partitioning Fix duplicate words in comments 2021-10-04 15:12:57 +02:00
po Translation updates 2021-06-21 12:33:50 +02:00
port windows: Remove use of WIN32_LEAN_AND_MEAN from crashdump.c. 2021-11-06 15:43:22 -07:00
postmaster autovacuum: Improve wording in a couple places 2021-11-22 12:55:36 -03:00
regex Make pg_regexec() robust against out-of-range search_start. 2021-09-11 15:19:31 -04:00
replication Be more specific about OOM in XLogReaderAllocate 2021-11-22 13:43:43 -03:00
rewrite Fix rewriter to set hasModifyingCTE correctly on rewritten queries. 2021-09-08 12:05:47 -04:00
snowball Update snowball 2021-02-19 08:10:15 +01:00
statistics Clean up more code using "(expr) ? true : false" 2021-10-11 09:36:42 +09:00
storage Fix parallel operations that prevent oldest xmin from advancing. 2021-11-19 09:04:40 +05:30
tcop Add pg_checkpointer predefined role for CHECKPOINT command. 2021-11-09 16:59:14 -08:00
tsearch Clean up more code using "(expr) ? true : false" 2021-10-11 09:36:42 +09:00
utils Allow Memoize to operate in binary comparison mode 2021-11-24 10:06:59 +13:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Use sort_template.h for qsort_tuple() and qsort_ssup(). 2021-03-03 17:02:32 +13:00
nls.mk Report progress of startup operations that take a long time. 2021-10-25 11:51:57 -04:00