Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0cf68d0

Browse files
committed
[PGPRO-4074] memcmp values in LR if type doesn't have equality op.
This facilitates an honorable goal of improving core regression tests results onmultimaster and hardly would affect anyone else.(cherry picked from commit 45b088a57c67185c74cbd740ec84bad4b0a5cac2)tags: multimaster(cherry picked from commit f33ae54cad67f56c2760085d0fdea4085758ece1)
1 parentfb7d899 commit0cf68d0

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

‎src/backend/executor/execReplication.c

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include"access/relscan.h"
1919
#include"access/tableam.h"
2020
#include"access/transam.h"
21+
#include"access/detoast.h"
2122
#include"access/xact.h"
2223
#include"commands/trigger.h"
2324
#include"executor/executor.h"
@@ -263,11 +264,33 @@ tuples_equal(TupleTableSlot *slot1, TupleTableSlot *slot2,
263264
{
264265
typentry=lookup_type_cache(att->atttypid,
265266
TYPECACHE_EQ_OPR_FINFO);
267+
/*
268+
* MTM-CRUTCH: vanilla bails out here if equality op can't be found,
269+
* i.e. type doesn't have btree nor hash opclasses, which means you
270+
* can't have e.g. box type as part of replica identity. That's
271+
* unfortunate for mtm as some regression tests (index_including_gist
272+
* for instance) do update/delete on geometric types without unique
273+
* index (full replica identity).
274+
*
275+
* Binary comparison done here is also dubious as generally equal
276+
* values might not be binary equal, but sane replication identities
277+
* should have btree opclass anyway. One more alternative would be to
278+
* try to search for 'same' strategy of R-tree gist, but it is
279+
* unreliable as gist strategies are not fixed...
280+
*/
266281
if (!OidIsValid(typentry->eq_opr_finfo.fn_oid))
267-
ereport(ERROR,
268-
(errcode(ERRCODE_UNDEFINED_FUNCTION),
269-
errmsg("could not identify an equality operator for type %s",
270-
format_type_be(att->atttypid))));
282+
{
283+
if (att->attlen==-1)
284+
{
285+
structvarlena*vl1= (structvarlena*)DatumGetPointer(slot1->tts_values[attrnum]);
286+
structvarlena*vl2= (structvarlena*)DatumGetPointer(slot2->tts_values[attrnum]);
287+
returndatumIsEqual(PointerGetDatum(detoast_attr(vl1)),
288+
PointerGetDatum(detoast_attr(vl2)),
289+
att->attbyval,-1);
290+
}
291+
returndatumIsEqual(slot1->tts_values[attrnum],slot2->tts_values[attrnum],
292+
att->attbyval,att->attlen);
293+
}
271294
eq[attrnum]=typentry;
272295
}
273296

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp