pgvector.git / summary / log / commit / refs

commit    cbcf35510d0cfcecd07aaee1d45e7d95e6f33ccf
Author:   Andrew Kane <andrew@ankane.org>
Date:     Thu Oct 22 20:47:38 2026 +0000

    Added check for left/right input types to amvalidate functions - closes #1045 [skip ci]


src/hnsw.c | 11 +++++++++++ src/ivfflat.c | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/hnsw.c b/src/hnsw.c index a2f481de..e6558f79 100644 --- a/src/hnsw.c +++ b/src/hnsw.c @@ -305,6 +305,17 @@ hnswvalidate(Oid opclassoid) Form_pg_amproc procform = (Form_pg_amproc) GETSTRUCT(proctup); bool ok; + /* Check matching left/right types */ + if (procform->amproclefttype != procform->amprocrighttype) + { + ereport(INFO, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("operator family \"%s\" of access method %s contains support function %s with different left and right input types", + opfamilyname, "hnsw", + format_procedure(procform->amproc)))); + result = false; + } + /* Check procedure numbers and function signatures */ switch (procform->amprocnum) { diff --git a/src/ivfflat.c b/src/ivfflat.c index a7f383e1..131b091e 100644 --- a/src/ivfflat.c +++ b/src/ivfflat.c @@ -222,6 +222,17 @@ ivfflatvalidate(Oid opclassoid) Form_pg_amproc procform = (Form_pg_amproc) GETSTRUCT(proctup); bool ok; + /* Check matching left/right types */ + if (procform->amproclefttype != procform->amprocrighttype) + { + ereport(INFO, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("operator family \"%s\" of access method %s contains support function %s with different left and right input types", + opfamilyname, "ivfflat", + format_procedure(procform->amproc)))); + result = false; + } + /* Check procedure numbers and function signatures */ switch (procform->amprocnum) { [parent: b28edffe33b4]